Objects: Grouping Related Data
An object keeps everything about one thing together: a pet's name, age and breed. Build objects, keep lists of them, unpack them with destructuring, and copy and combine them with spread.
Updated
Objects in JavaScript
- What Is an Object (Novice): An object keeps everything about one thing together under labels, like a form with labeled boxes, so you can read, change and list a pet's name, age and more by name.
- Arrays of Objects (Apprentice): An array of objects is a list of records, like a stack of filled-in forms, and it's how programs keep search results, carts and listings that you read, loop over and update.
Unpacking Data in JavaScript
- Destructuring (Apprentice): Destructuring unpacks the values you need from an object or an array into variables in one line, with defaults for anything missing and new names when you want them.
- Spread and Rest (Apprentice): Assigning an object to a new variable doesn't copy it, so this lesson shows how spread makes real copies and merges, and how rest gathers any number of values into one.
Exercise: Pet Adoption Profiles
- Exercise: Pet Adoption Profiles (Apprentice): Finish five functions for a pet adoption site, building profile lines with destructuring and safe copies with spread, and let the tests check each one.