Class Nine Notes (301)
Functional Programming
- Functional programming is a style of building the structure and element of computer pgrograms that treats computation as the evaluation of matth functions
- A pure function returns the same result if it’s givent the same arguments (deterministric), and does not cause any observable side effects
- The benefits of a pure function it’s easier for code-testing
- Immutability is something stays unchanged over time or unable to be changed
- Referential transparency consistently yields the same result for the same input
Node: Mdules and require()
- Module is another JS file
Require
brings in another JS file to the current file
- A different module can be brought in to the file we are working in by
require
, and specify what part of the module to be made available, by using module.exports = <var contains the function>
- To make a module available
Back to main page
References