NOTE : This is just out of curiosity, not a blocker for me as such.
while i was working on my NODE project, i hit something which actually confused me and i could not find why its so. please find sample code to understand the question
function a() {
console.log(this === GLOBAL); //true
}
console.log(this === GLOBAL); // false
a();
Now, in node documentation it clearly says
The top-level scope is not the global scope
so i understand from above note why this is false outside the function a(top-level). but then inside function a this is pointing to GLOABAL, why is that ?
i am using node-5.5.0, but i checked the behavior on node-0.12, its consistent
may be its some stupid misunderstanding from my side, bear with me.
UPDATE: by the way - this in top-level is module.exports, and this inside the function is GLOBAL