Objects: Named Properties
Learn how to group related data together using objects — JavaScript's key-value data structure.
Data with labels, not numbers
Arrays are great for ordered lists, but sometimes position numbers don't make sense. If you're storing information about a person — their name, age, and email — would you remember that index 0 is the name, index 1 is the age, and index 2 is the email? That's fragile and confusing.
Objects solve this by letting you label each piece of data with a descriptive name. Instead of positions (0, 1, 2), you use keys (name, age, email). Each key is paired with a value, forming a key-value pair. Together, the pairs describe a single thing — a person, a product, a song, a tweet.
Objects are everywhere in web development. API responses from servers, user profiles, configuration settings, and event data are all typically objects.
Nearly everything in JavaScript is an object or behaves like one. Arrays are objects. Functions are objects. Even strings have object-like behavior (which is why they have methods like `.toUpperCase()`). Understanding objects is understanding the core of JavaScript.