✔ is a programming paradigm, meaning that it is a way of thinking about software construction based on some fundamental, defining principles (listed above). Other examples of programming paradigms include object oriented programming and procedural programming.
A pure function is a function which:
-
Given the same inputs, always returns the same output
-
Has no side-effects
also ,Pure functions have lots of properties that are important in functional programming, including referential transparency (you can replace a function call with its resulting value without changing the meaning of the program).
- What are the benefits of a pure function? ✔ Pure functions are used heavily in Functional Programming. And, libraries such as ReactJS and Redux require the use of pure functions.
✔ pure functions can also be used in regular JavaScript that doesn’t depend on a single programming paradigm.
What is immutability? ✔ An immutable object is an object that can’t be modified after it’s created. Conversely, a mutable object is any object which can be modified after it’s created.
- What is 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. This implies that methods should always return the same value for a given argument, without having any other effect.
-
What is a module? ✔ A module is a piece of code that encapsulates the code for specific functionality. It makes it easy to write decoupled and easy maintainable and testable code.
-
What does the word ‘require’ do?
✔ function is the easiest way to include modules that exist in separate files.
-
How do we bring another module into the file the we are working in?
✔ need to _ import _ it
-
What do we have to do to make a module available? we need to export them