require() in js code example

Example 1: javascript require

// The require() method is used to load and cache JavaScript modules.
// So, if you want to load a local, relative JavaScript module into a Node.js application,
// you can simply use the require() method.

// Example:
var yourModule = require( "your_module_name" ); //.js file extension is optional

Example 2: nodejs require

//What is require in Nodejs?
//Node.js follows the CommonJS module system, and the builtin require 
//function is the easiest way to include modules that exist in separate 
//files. The basic functionality of require is that it reads a JavaScript 
//file, executes the file, and then proceeds to return the exports object.