I saw that line in some code
window.a = window.b = a;
How does it work?
Does the following always return true?
win
The a
and b
properties on the window are being assigned to the value of a
. Yes, if this code is executed in the global scope, a
and window.a
are the same.
var a = "foo";
//window.a and a are the same variable
window.a = "bar";
a; //bar
function f(){
var a = "notfoo";
//window.a is a different variable from a, although they may take the same value
window.a = "baz";
a; //notfoo
}