This article is in continuation of the previous post Part 1, where we learned what is Immutability, why we need it, Immutability with Arrays, etc.
I’ll recommend reading that first if you haven’t already! Still, if you want to continue particularly on Immutability of Objects, then Keep reading!
This section covers immutability of objects and various external libraries that we can use instead of maintaining immutability ourselves.
We saw earlier how it is not possible to make an object immutable just by assigning it to a const variable.
Objects work by reference, So any time you try to reassign, you…
Immutability is one of the fundamental concepts when we talk about functional Programming. Even if you think you are following it, sometimes you still might be violating it if you don’t have a thorough knowledge of it. This write-up’s purpose is to explain what is Immutability? , why we want to use it, and how to achieve it?
Iterators and Generators were introduced in ES6 to make it easier to iterate over different data structures that don’t just include Arrays, String, etc, it gives a common way to iterate over any advanced data structure. Without iterables and iterators, it was difficult to manage the iteration on data for various types of data structures. For example, iterating on an array is different from iterating on an object.
Let’s see, how!