reading-notes

Functional programming: A programming paradigm that emphasizes the use of pure functions and immutable data structures. Pure function: A function that always returns the same output for a given input, and has no side effects. Benefits of pure functions: Easier to reason about, test, and debug. They are composable and can be combined to create more complex functions. Immutability: The property of an object that cannot be changed after it is created. Referential transparency: The property of a function that allows it to be replaced with its return value without changing the program’s behavior. Module: A file that contains a set of related functions, classes, or variables. It allows code to be organized into logical units and makes it easier to reuse code across multiple projects. Require: A keyword in Node.js used to import modules. It loads the module into the current file and makes its contents available for use. How to import a module in Node.js: Use the require() function to import the module. How to make a module available: Export the module’s functions, classes, or variables using the module.exports object.

Concepts of Functional Programming in JavaScript

Pure functions

Immutability

Higher-order functions

Recursion

Function composition

Currying

Memoization