how to add new key to existing object in javascript code example
Example: add new key value pair to object javascript
const person = {
name: "Elon Musk"
}
person.age = 49;
console.log(person);
// {name: "Elon Musk", age: 49}
const person = {
name: "Elon Musk"
}
person.age = 49;
console.log(person);
// {name: "Elon Musk", age: 49}