From the course: Learning Functional Programming with JavaScript ES6+
Unlock this course with a free trial
Join today to access over 24,700 courses taught by industry experts.
Ensuring immutability with ESLint - JavaScript Tutorial
From the course: Learning Functional Programming with JavaScript ES6+
Ensuring immutability with ESLint
- [Instructor] So I talked in a previous video about the importance of immutability in functional programming. Immutability allows us to avoid the many bugs that occur in computer programs as a side effect of state change. It also means that we don't have to worry about using private variables to avoid changes coming from unexpected places, since we simply can't make changes to any piece of data. That being said, if we want to ensure complete immutability in JavaScript, there's something we need to keep in mind. While using the const keyword prevents us from directly changing the value of a piece of data, for example, if we say const X equals five, we can't simply say X equals six, since this will throw an error. However, using constant JavaScript is a little funny when working with arrays and objects. For example, if we define an array called numbers, like this, constant numbers 1, 2, 3, 4, 5, we can never directly redefine numbers as a different array like this, numbers equals…
Contents
-
-
-
(Locked)
The goal of functional programming3m 38s
-
(Locked)
Declarative vs. imperative programming2m 46s
-
(Locked)
Immutability4m 18s
-
(Locked)
Separation of data and functions1m 47s
-
(Locked)
Converting object-oriented to functional code3m 29s
-
(Locked)
First-class functions2m 33s
-
(Locked)
Ensuring immutability with ESLint3m 14s
-
(Locked)
Installing and setting up ESLint1m 14s
-
(Locked)
Ensuring immutability: Finalize ESLint2m 27s
-
(Locked)
-
-
-
-
-