0 votes
in JavaScript by
What is the purpose of the delete operator in Javascript?

1 Answer

0 votes
by

The delete keyword is used to delete the property as well as its value.

var user = { name: "John", age: 20 };
delete user.age;

console.log(user); // {name: "John"}
...