Immutability
Last updated
Was this helpful?
Last updated
Was this helpful?
Primitives, like strings and numbers, are immutable by default
Even if it is tried to be changed, new value with different memory address will be created instead of changing its original value
For function call , primitive input is immutable
Array and object are mutable
For function call , they are mutable
However, it is recommended to use immutable pattern for best practice to prevent from any side effect