Functional programming (also called FP) is a way of thinking about software construction by creating pure functions.
It avoid concepts of shared state, mutable data observed in Object Oriented Programming.
A pure function is a function which:
Given the same input, always returns the same output.
Produces no side effects.
They’re easier to reason about
They’re easier to combine
They’re easier to test
They’re easier to debug
They’re easier to parallelize
The literal meaning of Immutability is unable to change. In the Functional Programming world, w
e create values or objects by initializing them. Then we use them, but we do not change their values or their state.
If we need, we create a new one, but we do not modify the existing object's state.
In functional programming, referential transparency is generally defined as the fact that an expression,
in a program, may be replaced by its value (or anything having the same value) without changing the result of the program.
Module in Node. js is a simple or complex functionality organized in single or multiple JavaScript files
which can be reused throughout the Node. js application.
Each module in Node. js has its own context, so it cannot interfere with other modules or pollute global scope.
In NodeJS, require() is a built-in function to include external modules that exist in separate files.
require() statement basically reads a JavaScript file, executes it, and then proceeds to return the export object.
use require to import modules.
publish your module use npm publish.