+ 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 ?

24th May 2020, 10:31 AM
Oneill~ŠžŠ½ŠµŠøŠ»Š»~億尼尔~ą¤“ą¤Øą„€ą¤²~Ų§ŁˆŁ†ŪŒŁ„~*ā€Ž
Oneill~ŠžŠ½ŠµŠøŠ»Š»~億尼尔~ą¤“ą¤Øą„€ą¤²~Ų§ŁˆŁ†ŪŒŁ„~*ā€Ž - avatar
2 Answers
+ 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
24th May 2020, 11:45 AM
Basel.Al_hajeri?.MBH()
Basel.Al_hajeri?.MBH() - avatar
+ 1
thank for your answer
12th Jun 2020, 12:55 PM
Oneill~ŠžŠ½ŠµŠøŠ»Š»~億尼尔~ą¤“ą¤Øą„€ą¤²~Ų§ŁˆŁ†ŪŒŁ„~*ā€Ž
Oneill~ŠžŠ½ŠµŠøŠ»Š»~億尼尔~ą¤“ą¤Øą„€ą¤²~Ų§ŁˆŁ†ŪŒŁ„~*ā€Ž - avatar