Throughout my code, I have statements like this:
document.location.search="?a="+n;
I am trying to shorten (for code golf) it so that I do not have to type out the document.location.search every time.
The first thing I thought of was to set document.location.search to a variable, and then setting that variable, like this:
s=document.location.search;
s="?a="+n;
This, of course, does not work, because s is set by the value of document.location.search, and not its reference. Is there a way to set s by reference? Is there some other way I can eliminate repeated instances of document.location.search?
Write a function
and call