Differences between Object.freeze( ) and Object.seal( ) in Javascript

antoomartini

Maria Antonella šŸ¦‹

Posted on August 20, 2021

Differences between Object.freeze( ) and Object.seal( ) in Javascript

They are functions that may appear to do the same action but have significant differences. And it was difficult for me to learn it. I don't know why but they always confused me.

šŸ‘‰ Object.freeze(): It prevents you from adding new properties, removing existing properties and modifying them.

šŸ‘‰ Object.seal(): You can modify existing properties but you can't delete or add new ones.

CRUD Operations

If we differentiate them through the CRUD operations: Create - Read - Update - Delete, we obtain the following comparison.

                  Create     Read    Update     Delete
Object.freeze()    āŒ        ā˜‘ļø      āŒ         āŒ
Object.seal()      āŒ        ā˜‘ļø      ā˜‘ļø         āŒ

Enter fullscreen mode Exit fullscreen mode

The wonderful world of Javascript. That's all for today :)

šŸ’– šŸ’Ŗ šŸ™… šŸš©
antoomartini
Maria Antonella šŸ¦‹

Posted on August 20, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related