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:
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.