Ampersand Question

Hi Folks,

I've been raking my brain to try and understand what the Ampersand (&) in this function actually does:

function SwitchCheck()   {
                if (SW_form.SW1.checked) {
                    strSW1 = "&SW1=1";
                }
                else {
                    strSW1 = "&SW1=0";
                }
}

Essentially what this function does is check's to see if a checkbox contained in a form named SW_Form is checked or not and assigned a value to variable strSW1 accordingly. My question is, what is the difference between saying strSW1 = "&SW1=1"; and strtSW1 = "SW1=1"; ?
thanks !!!

What is strSW1 used for? Is it returned by a browser as a parameter?

Those are string literals.

With no context, it is impossible to answer your question.

It is like asking

 strSW1 = "blueMoon";

and wondering about

strSW1 = "theBlueMoon";

So... what's the entire problem where this comes up?

a7

It does nothing in that function. It is just part of a character string, which is probably intended to be sent somewhere.

To find out what it does, remove it and see what breaks. If nothing breaks it may do nothing and just be cosmetic.

One string has & another doesn’t have it. This is the difference. Who knows how it used later

it's part of querystring and will be put into a URL to inform the web server of the state of a switch.

Thanks for all the reply's.
I think "6v6gt" is correct.
See the following url for additional context from the original code:

3/4 down the page is were the switches are discussed, and I can now see how this is related to the url that gets passed to the server on this line of the code in my specific application:
request.open("GET", "ajax_inputs" + strSW1 + strSW2 + strSW3 + strSW4 + nocache, true);
I got confused and started down the rabbit hole of trying to understand why a pointer access operator was being used... Obviously, this was a bad assumption made on my part... Thanks for your help all...