Immutability
noun
say it: “ih-myoo-tuh-BIL-ih-tee” /ɪˌmjuːtəˈbɪlɪti/
Leaving a value unchanged once it's made, and making a new value whenever something needs to change. In JavaScript, strings already work this way.
What is Immutability in JavaScript?
Immutability — The practice of creating new values instead of changing existing ones.
const order = { item: "tea", quantity: 1 };
const updatedOrder = { ...order, quantity: 2 };
In a sentence
- “Because of immutability, toUpperCase() gave me a new string and the old one stayed lowercase.”
Level: Freelancer · More JavaScript terms at this level
Updated