Plain Objects

In this chapter, we will cover the following recipes:

  • Using Object.assign to add properties to an object
  • Using Object.entries to get iterable property-name pairs
  • Using Object.is to compare two values
  • Defining function properties as methods on a plain object
  • Defining read-only props with Object.defineProperty
  • Overriding read-only props with Object.defineProperty
  • Creating a non-enumerable property with Object.defineProperty
  • Creating an object using object structuring
  • Picking values from an object using destructuring
  • Using a spread operator to combine objects

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.