let person = { firstname: 'John', lastname: 'Doe' } console.log(person.firstname); // expected output: "John" delete person.firstname; console.log(person.firstname); // expected output: undefined

javascript delete key from object

// Example 1 var key = "Cow"; delete thisIsObject[key]; // Example 2 delete thisIsObject["Cow"]; // Example 3 delete thisIsObject.Cow;

js remove key from object

Similar Code Examples