I am Hack Sparrow
Captain of the Internets.

Archive for November, 2012

Global Variables in Node.js

So you are working with a set of Node modules, maybe a framework like Express.js, and suddenly feel the need to make some variables global. How do you make variables global in Node.js? The most common advice to this one is to either "declare the variable without the var keyword" or "add the variable to the global object" or "add the variable to the GLOBAL object". Which one do you use? First off, let's analyze the global object. Open a te ...