You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sandesh Kota edited this page Nov 27, 2019
·
56 revisions
A javascript runtime environment that executes the Javascript code outside of a browser. It can run on various platforms (Windows, Linux, Unix, Mac OS X, etc..)
Modules is a wrapper on set of functions. Similar to libraries. In the above example "http" is a module and by writing require('http') we will have access to HTTP module and its functionalities (like create server).
Custom Module
Add below code and create a file "firstmodule.js"
exports.myDateTime = function () {
return Date();
};
Use it as below
var dt = require('./myfirstmodule'); -- file path
console.log(dt.myDateTime());