JS Coding Questions Logo
JS Coding Questions
#71💼 Interview💻 Code

What is the purpose of the delete operator

Advertisement

728x90

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

javascript
1var user = { firstName: "John", lastName: "Doe", age: 20 };
2
3delete user.age;
4
5console.log(user); // {firstName: "John", lastName:"Doe"}

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 72

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
71of476