-
Functional programming is a programming paradigm — a style of building the structure and elements of computer programs — that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data — Wikipedia
-
A function is pure if it returns the same result if given the same arguments and it does not cause any observable side effects.
-
Pure functions are easier to test because the only things that need to be chaecked against are the parameters.
-
Immutable data cannot be changed
-
If a function consistently yields the same result for the same input, it is referentially transparent.
-
A file containing code with one specific functionality.
-
It allows you to link to another file and gain access to resources that it has exported.
-
require('./filepath')
. -
In the file containing the module,
module.exports = function
.