How do you add to an object like this?
Add it to what? Do you want to have more than one object like that?
Do you mean add more attributes?
Say we have this,
const person = {
name: "Wee Gillis",
age: 19
};
and wish to add the two attributes, weekAlarm
and weekendAlarm
,
person['weekAlarm'] = 'Alarm set to 7AM';
person['weekendAlarm'] = 'No alarms needed';
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.