The following code is working as expected
obj = {
go: function() { alert(this) }
}
obj.go(); // object
(obj.go)(); // object
(a = obj.go)(); // window
(0 || obj.go)(); // window
but why error occurred when I comment the beginning two lines?
obj = {
go: function() { alert(this) }
}
//obj.go(); // commented this line
//(obj.go)(); // commented this line
(a = obj.go)(); // window
(0 || obj.go)(); // window
I didn't change any of the code above, just comment two lines which are separate from others, then the browser gives me error information? Could anyone please clarify that for me? many thanks.