is as follows: it"s a piece of code on a MDN
var x = 0;
function f(){
var x = y = 1; // xy
}
f();
console.log(x, y); // 0, 1
// x
// y
Q:
1. Why the result is 0BI 1
2. Why does the code comment say, "x is declared inside the function, y is not!"
3. What is an implicitly declared global variable
based on the above, I changed the code as follows:
function f(){var a = b = 1; }
f();
console.log(b);// 1
console.log(a);// a is not defined
ask: why an is not defined
the students who are in trouble will help me to answer it. Thank you!