Good - therefore, you need to use the call to Object.freeze t to make the object immutable. Even strict mode is not required.
const x = {a:"sss"}
Object.freeze(x);
x.a = "k"
console.log(x)
Outputs:
x.a = "k"
^
TypeError: Cannot assign to read only property 'a' of object '#<Object>'
source
share