← Lessons CP 📦 Object Explorer ● ● ● ●
🏝️ Treasure Island — An object is like a treasure chest with labeled compartments! Each compartment has a key (the label) and a value (the treasure inside). You can store strings, numbers, arrays — anything! Just like in Array Adventure you stored items in a list, now you store items in a labeled chest!

📦 What's an Object?

An object in JavaScript is a container that holds properties. Each property has a key (a name) and a value (the data). Think of a backpack: each pocket has a label (key) and something inside (value). In code: { name: "Treasure", coins: 100 }. Use dot notation to get a value: chest.name gives you "Treasure". Objects are how real programs organize related data — a player has a name, score, and level stored together! 🎒 Remember: In Function Factory you built reusable functions. Now objects let you bundle data together just like functions bundle actions!

🎯 Today's Missions Add 3 properties! Access a property value! Complete all 4 challenges!

🏝️ Treasure Chest Builder

Add labeled properties → See your object grow!

🗝️
Your treasure chest is empty! Add properties below ✨
🏷️ Key Property name
🔤 Type String or Number?
📋 Your Properties (no properties yet — add one above!)
📦 Presets Ready-made chests!
🔍 Access chest.key = ?
myObject. = ?
Properties: 0
📄 Live Code View
// Your object will appear here
let myObject = {
  // add properties above!
};

// Access a property:
myObject.key; // = value

🎯 Object Challenges

1
Create an object with at least 2 properties — add any key + value pairs!
2
Add a property with a number value (e.g. coins: 100)
3
Use a preset object (treasureChest, player, or pet) then access a property from it
4
Your turn! Build an object about YOURSELF — add at least 4 properties about you (name, age, favColor, etc.)
🌟 Mastery progress0%

📦 Object Explorer

Welcome to Treasure Island! Today you'll learn about objects — containers that hold data with labeled compartments. Each compartment has a key (the label) and a value (the data). In JavaScript, we use curly braces {} to make an object!

🏷️Type a key (property name) and a value (like item: "gold coin")
Tap Add Property to store it in your object
🔍Use the Access tool to look up any property value by its key
📦Try the Presets — ready-made objects. That's data organization! 🎉