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"}

Related questions

0 votes
asked Oct 7, 2023 in JavaScript by GeorgeBell
0 votes
asked Oct 7, 2023 in JavaScript by GeorgeBell
...