js object add new element code example
Example: adding element to javascript object
let person = {
name : 'John Doe',
age : 35
}
//Now we can add element by 2 ways
person.occupation = 'Web Designer'
//or
person['occupation'] = 'Web Designer'; //This is usefull for adding element within loop.
object[yourKey] = yourValue;
object.yourKey = yourValue;