+ 2
about seal() ?
Object.seal(object) // Prevents changes of object properties (not values) what the meaning exactly ? it's different with freeze() but how it works ?
2 odpowiedzi
+ 1
As you say Object.seal prevents changing Object.properties not values ..
Object.freeze is same with this issue but it prevents values too except Arrays and Objects their values are prevented but their values includes them can be changing
Example:
const obj = Object.freeze({
arr :[]
});
obj.arr = ''; // impassable and TypeError in strict mode
obj.arr.push('String'); // no problem here
+ 1
thank for your answer