Back to search

Property descriptors, getters and setters, Object.create, hasOwnProperty, and the in operator

JavaScript objects support descriptor-level control, computed accessors, explicit prototype creation, and different ways to check for properties.

JavaScript Hard Theory

Property descriptors, getters and setters, Object.create, hasOwnProperty, and the in operator

JavaScript objects support descriptor-level control, computed accessors, explicit prototype creation, and different ways to check for properties.

  • Descriptors control writability and enumerability
  • Getters and setters run code on access
  • `in` and `hasOwnProperty` answer different questions

Property descriptors, getters and setters, Object.create, hasOwnProperty, and the in operator