const person = {
firstName:"Sidharth",
age: 25,
isAdult:true
}
console.log(person);
console.log(person.firstName);
console.log(person["firstName"]);
console.log(person["first"+"Name"]);
console.log(person.age);
console.log('Delete isAdult field: delete person.isAdult : ');
delete person.isAdult;
console.log(person);
console.log('Added new property "lastname" to person object: ');
person.lastname = 'Pandey';
console.log(person);
Output:
=======
{firstName: "Sidharth", age: 25, isAdult: true}
Sidharth
Sidharth
Sidharth
25
Delete isAdult field: delete person.isAdult :
{firstName: "Sidharth", age: 25}
Added new property "lastname" to person object:
{firstName: "Sidharth", age: 25, lastname: "Pandey"}