HomeTutorsContact
JavaScript
How to delete a property from a JavaScript object?
Gulshan Saini
June 27, 2020
1 min

Deleting a property from the JSON object can be done using the delete operator. You might want to delete property to

  • remove unnecessary property from an object
  • omit secure information like a password from the user object before transmitting a response from a server to client

Let’s see delete operator in action

Say we have the following user object

Now if we want to delete the password property from user object it can be done as follows

If we print the user object again the password property won’t exist anymore


Tags

#javascript
Previous Article
How to freeze an Object in JavaScript?

Subscribe to our newsletter!

We'll send you the best of our blog just once a month. We promise.

Related Posts

How to Get Current Date in Human Readable Form in JavaScript?
October 03, 2020
1 min
© 2020, All Rights Reserved.

Quick Links

Advertise with usContact Us

Social Media