Why is String immutable in JavaScript?

JavaScript strings are immutable. This means that once a row is created, it cannot be changed. However, it is still possible to create another row based on the operation on the original row

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures

I understand what immutable value means , but I need to know why they built it like this and what is the value of this immutable approach?

Note. I have looked at the Java link , but I am not a Java developer and I cannot understand the terms there (StringPool, hashcode ...)

+3


source to share





All Articles