-
Notifications
You must be signed in to change notification settings - Fork 0
Delete Properties from a JavaScript Object
Antonio Vargas edited this page Dec 12, 2016
·
1 revision
Delete Properties from a JavaScript Object
We can also delete properties from objects like this:
delete ourDog.bark; Instructions
Delete the "tails" property from myDog. You may use either dot or bracket notation.
// Example
var ourDog = {
"name": "Camper",
"legs": 4,
"tails": 1,
"friends": ["everything!"],
"bark": "bow-wow"
};
delete ourDog.bark;
// Setup
var myDog = {
"name": "Happy Coder",
"legs": 4,
"tails": 1,
"friends": ["Free Code Camp Campers"],
"bark": "woof"
};
// Only change code below this line.
delete myDog.tails;