Immutability (Programming)
In programming, immutability refers to the characteristic of a value/object whereby it does NOT allow the program to mutate (modify) it.
More details
For example, strings in JavaScript are immutable values. If we go on and invoke a method such as toUpperCase()
on a string str
, we'd get back a completely new string — the original string is not modified.
The complement of immutability is the idea of mutability whereby a value/object allows the program to mutate it.