Sikau JavaScript · Day 37 · about 25 min
Reading and updating Dot and bracket notation.
Change the card Your friend moves city or has a birthday. Objects can be updated, grow new properties, and lose old ones. Today you'll also meet a second way to read properties: square brackets.
Update, add, delete const friend = { name: "Pemba", city: "Namche", age: 24 };
friend.age = 25;
friend.job = "guide";
delete friend.city;
console.log(friend);
console.log(friend.city); The rest of this lesson Bracket notation explain Objects as lookup tables explain Predict the output predict Dot or bracket? predict Your turn write code Challenge challenge Badge quiz quiz What you learned recap Continue this lesson free — run real code in your browser
Continue with GoogleSee all 68 lessons of JavaScript