What is the difference between Object.freeze and Object.seal? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

What is the difference between Object.freeze and Object.seal?

Is it possible to assign new properties to an object that has been sealed and also output its value?

6th Jul 2019, 2:26 PM
eMBee
eMBee - avatar
2 Answers
+ 5
When you seal an object, you can't add new properties to the object, but you can assign new values to object properties; but if you freeze an object, its properties can't even be changed
6th Jul 2019, 2:52 PM
Airree
Airree - avatar
+ 5
Oh, @Airree I gat you
6th Jul 2019, 3:33 PM
eMBee
eMBee - avatar