var a = 10;
var obj1 = {
a: 20,
fn: (function() {
this.a *= 2;
a = 5;
var a = 6;
return function() {
this.a *= a;
console.log(a)
}
})()
}
var obj2 = {
a: 30
}
var fn = obj1.fn;
fn(); //6???
obj1.fn(); //6???
obj1.fn.call(obj2); //6???
as shown above, after the function runs, the result is 6, respectively, but I don"t understand why it is 6. Even if an equals 6 after var a = 6, then why is an equal to 6 after this.a * = a? Ask the great god for advice.