Skip to content

Instantly share code, notes, and snippets.

@natevw
Created April 1, 2011 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save natevw/898111 to your computer and use it in GitHub Desktop.
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
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]
*/
@natevw
Copy link
Author

natevw commented Apr 1, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment