# a.js :
#! /usr/bin/env node
// coding: utf-8
// author: ruandao([email protected])
var app = exports;
app.yaha = 'jjj';
app.yahajk = 'eklj';
app.echo = function(){
console.log(this.yaha);
};
and I run in node:
> yan@cpu:~$ node
> a=require('./a');
{ yaha: 'jjj',
yahajk: 'eklj',
echo: [Function] }
but why , I never assignment *app* to *exports *, it should be undefined
object!
*
*
=======================================================================================================
and again, when I wrote this:
# a.js :
#! /usr/bin/env node
// coding: utf-8
// author: ruandao([email protected])
var app = {};
app.yaha = 'jjj';
app.yahajk = 'eklj';
app.echo = function(){
console.log(this.yaha);
};
exports = app;
in node :
> yan@cpu:~$ node
> a=require('./a');
{}
> var c = {};
undefined
> c.yaha = 'jjj';
'jjj'
> c
{ yaha: 'jjj' }
>
why app's peoperties: *yaha, yahajk *and it's method *echo *lose
thanks very much!
--
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