Created
April 1, 2011 13:04
-
-
Save natevw/898111 to your computer and use it in GitHub Desktop.
node.js shell executes line twice if it returns function and doesn't end in semicolon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.get_funky = function () { | |
console.log("funky"); | |
return function () {}; | |
} | |
exports.get_nuffin = function () { | |
console.log("nuffin"); | |
} | |
/* | |
> var test = require('./test.js'); | |
> test.get_funky(); | |
funky | |
[Function] | |
> test.get_funky() | |
funky | |
funky | |
[Function] | |
> test.get_nuffin() | |
nuffin | |
> test.get_nuffin(), test.get_funky() | |
nuffin | |
funky | |
nuffin | |
funky | |
[Function] | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nodejs/node-v0.x-archive#870