reading-notes

Reading 9 - Functional Programming

Source: Functional Programming Concepts

Q1 What is functional programming?

Functional program is a style of programming that focuses on evaluating functions over modifying data.

Q2 What is a pure function and how do we know if something is a pure function?

A pure function is one that will return the same result when given the same argument, and has no side effects. You know a function is pure if it does not need to read any external files, use a random number generator, or cause any side effects such as modifying a global object or passing a parameter by reference.

Q3 What are the benefits of a pure function?

A pure function will have code that is easier to test and are more predictable.

Q4 What is immutability?

Immutability is unchanging over time or unable to be changed.

Q5 What is Referential transparency?

Referential transparency is when a function consistently returns the same result for the same input.

Source: Node JS Tutorial for Beginners #6 - Modules and require()

Q6 What is a module?

A module is a reusable piece of JavaScript code with a specific functionality.

Q7 What does the word ‘require’ do?

“Require” imports modules or files into your JavaScript code.

Q8 How do we bring another module into the file the we are working in?

To bring another module into the file, you pass the name of the file as an argument to the “require” function.

Q9 What do we have to do to make a module available?

To make a module available to other modules, it has to be exported.

Things I want to know more about

What other things that we’ve been using are from vanilla JavaScript and which things are from Node.js