Learn JavaScript

Lesson 2 of 9 · Objects, Destructuring, Spread and JSON

Module 8 · Objects, Destructuring, Spread and JSON

Every Object Operation, One by One: Keys, Copies, Destructuring and JSON

Free with an accountReading

Nadia builds the settings page of a quiz app. Her code reads a user's saved settings, fills in defaults, copies them before an edit, and sends them to a server as JSON. Every one of those steps is an object operation. Each one either changes the object in place or returns something new. Mixing the two up is the most common object bug she has ever had.

Checking what this lesson needs for you…

What is inside Every Object Operation, One by One: Keys, Copies, Destructuring and JSON

  1. Dot against bracket access
  2. Adding and deleting keys
  3. The in operator against hasOwnProperty
  4. Object.keys, values and entries
  5. for-in done right
  6. Nested objects
  7. Methods: functions as values
  8. Computed keys
  9. Shorthand properties
  10. References against values
  11. Shallow copy with spread and Object.assign
  12. structuredClone for a deep copy
  13. Object.freeze stops changes
  14. Destructuring objects
  15. Destructuring arrays
  16. Destructuring in parameters
  17. The rest in destructuring
  18. JSON.stringify
  19. JSON.parse
  20. Optional chaining, finished
  21. Changes the object, or returns a new one