How it works...

In this recipe, we see that object properties are not simple key-value pairs. They have attributes that governern their behavior. One of these properties is writable. This property means that we can reassign the value afterwards. By default, this property is set to true; using Object.defineProperty we can see other values.

We'll see how other properties can be used to control other behaviors.

Get ECMAScript Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.