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
- Dot against bracket access
- Adding and deleting keys
- The in operator against hasOwnProperty
- Object.keys, values and entries
- for-in done right
- Nested objects
- Methods: functions as values
- Computed keys
- Shorthand properties
- References against values
- Shallow copy with spread and Object.assign
- structuredClone for a deep copy
- Object.freeze stops changes
- Destructuring objects
- Destructuring arrays
- Destructuring in parameters
- The rest in destructuring
- JSON.stringify
- JSON.parse
- Optional chaining, finished
- Changes the object, or returns a new one