Class 09 Notes
Functional Programming Concepts
Functional programming is a style of building the structure and elements of a program.
A pure function is a function that:
-
Returns the same results if given the same arguements
-
It doesn’t cause any observable side effects.
The benefits of a pure function are that you can expect to see a specific outcome when having an input in a pure function.
Immutability means that the state does not change over time. Instead a new object is created with a new value.
Referential transperancy is the use of a pure function with immutable data.
Node JS Tutorial for Beginners #6 - Modules and require()
A module is a bit of code that is split up from the main app. It is split so that it is only loaded and used once called upon.
The word require is used to say that we require the module that you specified within your app.
You can bring another file, into the one you are currently working, you must use the module.exports within your module and spcify which functions to export.
You need to make a variable that is equal to the required module in order to make the module available.