During my search for some JS Code, I stumbled upon this piece of code.
Check out the code snippet below:
arg = "TEST ALERT MESSAGE";
MyFunction(arg);
function MyFunction()
{
alert(arg)
}
In the above code snippet, the MyFunction() is provided with an alert message, but there is no parameter to receive the incoming argument.
Surprisingly, when I try to change the 'arg' variable (both inside and outside the function), it doesn't work as expected.
How is this possible?
Appreciate any help in advance