From the course: Learning Functional Programming with JavaScript ES6+
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Ensuring immutability: ESLint - JavaScript Tutorial
From the course: Learning Functional Programming with JavaScript ES6+
Ensuring immutability: ESLint
- [Instructor] So, I talked in the 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 const in JavaScript is a little funny when working with arrays and objects. For example, if we define an array called numbers, like this, const numbers, one two three four five, we can never directly redefine numbers as a different array like this, numbers…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
The goal of functional programming3m 38s
-
Declarative vs. imperative programming2m 46s
-
Immutability4m 18s
-
Separation of data and functions1m 47s
-
Object oriented to functional approach3m 29s
-
First-class functions2m 33s
-
Ensuring immutability: ESLint3m 14s
-
Ensuring immutability: Install ESLint1m 14s
-
Ensuring immutability: Finalize ESLint2m 27s
-
-
-
-
-
-