

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 5
click for more info
Not enough gems
Cost: 6 gems
1: Objects
incomplete
2: No Colon
incomplete
3: Updating Properties
incomplete
4: Nesting Properties
incomplete
5: Nesting Properties Quiz
incomplete
6: Optional Chaining
incomplete
7: When to Chain
incomplete
8: Object Methods
incomplete
9: Methods Mutate
incomplete
10: Initializing Props
incomplete
11: Strings As Keys
incomplete
12: This
incomplete
13: Arrow Functions
incomplete
14: Fat Arrows and This
incomplete
15: Spread Syntax
incomplete
16: Return Objects
incomplete
17: Destructuring
incomplete
18: Not Bound
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
You can update and add new keys (you'll see me use the words "property" and "key" interchangeably in this course) to an existing object using the . operator. If it exists, it's updated; if it doesn't, it's created as a new property:
const apple = {
name: "Apple",
radius: 2,
color: "red",
};
apple.numSeeds = 3; // new property
apple.color = "green"; // update property
// {"name":"Apple","radius":2,"color":"green","numSeeds":3}
In Textio, users create text campaigns to send messages to their contacts. Each campaign needs a unique ID for tracking and management.
Complete the addID function. It takes a campaignRecord object as input and returns it with a newly generated string id property. The id should be created by joining campaignName and senderName with a hyphen (-). For example:
summerSales-adam
Where campaignName and senderName are already properties of the campaignRecord object.