methods of deleting object attributes in js. code example
Example 1: Delete Properties from a JavaScript Object
var ourDog = {
"name": "Camper",
"legs": 4,
"tails": 1,
"friends": ["everything!"],
"bark": "bow-wow"
};
delete ourDog.bark;
Example 2: how to delete a property from a javascript object
var person = {
firstName:"John",
lastName:"Doe",
age:50,
eyeColor:"blue"
};
delete person.age; // or delete person["age"];
// Before deletion: person.age = 50, after deletion, person.age = undefined