It's "exports". I don't remember why, but it'd probably break a bunch of
programs to change it now.

The module is run in a function that's called on the exports object.

On Sunday, July 1, 2012, Steven Yang wrote:

> 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 contextshould be 
> the same as `this` in external
> 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]<javascript:_e({}, 'cvml', '[email protected]');>
> To unsubscribe from this group, send email to
> [email protected] <javascript:_e({}, 'cvml',
> 'nodejs%[email protected]');>
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>

-- 
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