one small change by Derric Wise

What does immutability really mean?

and how is it applied in JavaScript?

Aphinya Dechalert
Published in
7 min readMay 4, 2020

--

The concept of immutability is a funny one.

In one translation, it can mean unchanging — however, setting something up as a let or var and then not allowing it to change might as well be as good as using const

There are a lot of people who take this translation a bit too far in its application, and as a result, misunderstand the concept and depth of immutability.

In this piece, I’ll be decrypting the idea of immutability and how it is applied in JavaScript.

Let’s look at the meaning of immutability

The word immutability has its origins in Latin and means “not changeable”. Its official synonym is “changeless” and when applied to computer programming, the idea is pretty much the same.

However, this application is often oversimplified. Many developers associate immutability with the inability to change anything at all.

For example:

var cat = "Tibbers";
cat = "Tibbles";

According to the incorrect application of the concept, the above example is regarded as a violation of immutability.

--

--

Aphinya Dechalert
Modules&Methods

Where Development Meets Storytelling: Tech Writer, Editor & Dev Advocate. Translating Complexity into Clarity. DM me. linkedin.com/in/dechalert