JavaScript
/Advanced
Property Descriptors
Definition
Hidden configuration objects attached to every property in a JavaScript object that define its behavior (whether it is writable, enumerable, or configurable).
Explain Like I'm New
When you add a property to an object (`obj.name = 'Alice'`), JS secretly creates a control panel for that property. Property Descriptors are how you open that control panel and flip switches, like making a property completely un-deletable or invisible to `for...in` loops.
Real World Example
Defining a hidden 'id' property on an object that cannot be altered (`writable: false`) and doesn't show up when looping over the object (`enumerable: false`).
Common Use Cases
- •Library authoring
- •Protecting sensitive object data
- •Getters and Setters
Interactive Example
Loading...
Console output will appear here...
Interview Questions
basic
- How do you define a property with descriptors?
intermediate
- What does `enumerable: false` do?
advanced
- What is the difference between `writable: false` and `configurable: false`?