Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Simple node require example
/* jshint node:true, es3:false */
// we need some complex maths functions :)
var maths = require('./maths');
console.log(maths.XplusY(2, 4));
console.log(maths.XtimesY(2, 4));
/* jshint node:true, es3:false */
// the maths module handles all your complex calulations
exports.XplusY = function(x, y){
return x + y;
};
exports.XtimesY = function(x, y){
return x * y;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment