Program:
math.js:
app.js:
Output:
math.js:
var calculate_square = function(number){ console.log(number*number); }; var calculate_cube = function(n){ console.log(n*n*n); };
app.js:
module.exports.calculate_cube = calculate_cube; module.exports.calculate_square = calculate_square; var math = require('./math') math.calculate_cube(5); math.calculate_square(5);
Output: