remove “?” from all anchor text

i am trying to remove the query string “?” from all anchor text with javascript

for example, there are many URLs like this

<a href="https://example.com/something/?">my anchor</a>

i just want to remove ? from all anchor text. i tried this but getting the error index of is not a function

    var url = jQuery("a");
    var a = url.indexOf("?");
    var b =  url.substring(a);
    var c = url.replace(b,"");
    url = c;