Skip to content

FlashcardNot attempted

Property descriptors

Recall it before you reveal

What are the four flags on a data property, and what does each control?

Space to reveal
Show answer & explanation
  • value: the stored value
  • writable: can the value be changed?
  • enumerable: does it show up in Object.keys, for...in, spread and JSON.stringify?
  • configurable: can it be deleted, or its flags changed?

Literal properties default to all true; Object.defineProperty defaults missing flags to false. Accessor properties swap value/writable for get / set.