Core Javascript

Concept of Immutable and Mutable

Immutable : We can not change value of primitive type, all the primitive types are immutable

Ex : null, undefined, string, number, boolean

1. When we do operations like below , it will return new string
var str = “abc”;
str.toLowerCase, str.split

Mutable : you can change the properties or itself the object to the some other value. You can change the property of Object or you can change the property of Arrays

Ex : Object , Arrays

Reference

DateVid

Leave a Reply

Your email address will not be published. Required fields are marked *