After discussing the first-class function and pure function in the previous chapter, now let's talk about a mutable and immutable object. As you have learned, we have to be able to pass a function to another function in a first-class function and ensure that the function returns the same value if we pass the same argument as well. The immutable object, which we will discuss, can help us make these two functional programming concepts available in our code. The topics we will discuss in this chapter are as follows:
- Modifying the variable in a functional programming approach
- Demonstrating the use of const keyword to avoid value modification
- Applying first-class and pure functions to immutable objects
- Refactoring the mutable object into an immutable object
- The benefit of an immutable object over a mutable one