Objects
Objects are where your data lives. Read and write properties, destructure them, copy them without secretly sharing nested state, describe them with accessors and descriptors, freeze them, serialise them to JSON, and reach into them safely when parts may be missing.
What you will be able to do
- Read and write properties with dot, bracket and computed keys, and predict key order
- Destructure objects and arrays with defaults, renames, nesting and rest
- Explain why a spread copy still shares nested objects, and copy deeply on purpose
- Convert between objects, entries and Maps, and check for a property three different ways
- Serialise to JSON knowing exactly what is lost, and read missing data without crashing
Lessons
- Object Basics — An object is a bag of named references, and the name can be computed while the program runs. (11 min)
- Destructuring — Destructuring is a pattern that mirrors the shape of the value, read right to left. (12 min)
- Spread, Merge and Cloning — A spread copy is one level deep. Everything nested is still shared with the original. (12 min)
- Object Utilities — Turn an object into entries, use array methods, turn it back. That covers most object work. (11 min)
- Getters, Setters and Descriptors — Every property is a small record of settings. A getter is a property whose value is a function call. (11 min)
- Freezing and Immutability — Freezing locks one object, not the objects it points at. (10 min)
- JSON — JSON is a text format with fewer types than JavaScript, so every round trip loses something. (11 min)
- Optional Chaining and Safe Access —
?.means "if this is null or undefined, stop and give me undefined", nothing more. (9 min)