If you are writing code for Node, using Node modules as described by Ivan is without a doubt the way to go.
However, if you need to load JavaScript that has already been written and isn't aware of node, the vm module is the way to go (and definitely preferable to eval).
For example, here is my execfile module, which evaluates the script at path in either context or the global context:
var vm = require("vm");
var fs = require("fs");
module.exports = function(path, context) {
(function() {
var data = fs.readFileSync(path);
vm.runInThisContextrunInNewContext(data, path);
}).call(context ||, GLOBALpath);
}
(note: I use runInThisContext because runInNewContext seemed to do strange things when loading into the global context)
Also note: modules loaded with require(…) don't have access to the global context.