+ 6
Please explain me why value of "y" doesn't change after the "foo" function?
4 Answers
+ 10
y = 7;
function foo() {
y = 4;
}
foo();
alert(y);
+ 7
because you only change the value of x,
there is only one statement that changes a variable it's x=4;
+ 7
Ok, but how to change the value of y?
0
Thank you very much