Prevent adding/deleting properties in a JavaScript object with Object.seal() method

Share this video with your friends

Send Tweet

Sometimes it's necessary to have a fixed set of properties on a JavaScript object, while also maintaining the option of changing those properties.

In this lesson we are going to learn how to use Object.seal() method to prevent new properties from being added to it and marking all existing properties as non-configurable. Values of present properties can still be changed.