Question 1
function bar(){
//....
}
in chrome environment:
console.log(this.bar)//bar
console.log(window.bar)//bar
so you can think of bar as bound to window.
< hr > so:
in node environment:
console.log(this.bar)//undefined
console.log(global.bar)//undefined
what is bar bound to at this time?
Question 2
var obj = {};
console.log(obj.a)//undefined
normally, obj.an is not defined. should be reported here.
actually executing this code here gives obj an attribute of an and assigns the value to undefined.
I read this in a book, and suddenly I don"t remember the answer.
I remember that this is the bug, of an object, so it has to be handled this way.
here I want to know what this bug is