Hi,
   I stumbled upon an intriguing behavior in nodejs's module. I want to 
figure out the 'global' object for each module and I tried the following 
code:

https://gist.github.com/3028821

console.log(this);
console.log(this === global);

(function () {
  console.log(this);
  console.log(this === global);
})()

   What get me confused is the self-invoking function. Within it, `this` 
should refer to the object invokes this function and in the 
context<member:context>should be the same as `this` in external 
context <member:context>. But why they behave differently?

   What is `this` in the "root" module scope?


Best,
  

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to