how require works in javascript?
The basic functionality of require is that it reads a JavaScript file, executes the file, and then proceeds to return the exports object. It is worth noting that each time you subsequently require an already-required file, the exports object is cached and reused. To illustrate this point: node> require('./example.