From the course: Learning Functional Programming with JavaScript ES6+
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Immutability - JavaScript Tutorial
From the course: Learning Functional Programming with JavaScript ES6+
Immutability
- [Instructor] The first major concept of functional programming is immutability, and it's a concept that may surprise a lot of people at first. Most programmers learned early on that you could assign a value to a variable. For example, we can define a variable called x and store the value five in it. And then, later on in the program, we can change the value of that variable to some completely different number. And later on, we can change this value again, and so on. However, in functional programming, this is not allowed. When we say that x is equal to five, we mean that, for the rest of the program, x will only ever be five. There's no way we can change it. In short, immutability means that most of the values in a program are constant, which, in JavaScript, means using the const keyword instead of the var or let keywords. Another way to think about it is this. In object-oriented and procedural programming, we treat variables as buckets that we can put values into. We call this…
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
-
-
-
(Locked)
The goal of functional programming3m 38s
-
(Locked)
Declarative vs. imperative programming2m 46s
-
(Locked)
Immutability4m 18s
-
(Locked)
Separation of data and functions1m 47s
-
(Locked)
Object oriented to functional approach3m 29s
-
(Locked)
First-class functions2m 33s
-
(Locked)
Ensuring immutability: ESLint3m 14s
-
(Locked)
Ensuring immutability: Install ESLint1m 14s
-
(Locked)
Ensuring immutability: Finalize ESLint2m 27s
-
(Locked)
-
-
-
-
-