What does array mutation mean?

What does array mutation mean?

It means you actually change the array, rather than creating a new object. See, when you do something like Array.push("value"), you are pushing the value “value” onto the array Array. BUt the array is kept. However, when you do something like string concatenation:

let stringOne = "hi";
stringOne += " there"; //concatenates " there" to the stringOne (which stores "hi")

An entirely new string is created, containing the values “hi there”.

I hope this helps!

2 Likes