How to remove a property from a Javascript Object

You would like to remove a given property from a javascript object. Here is a simple example of how you could do it :

You have defined an object similar to the following:

let oneObject = { “Prop1”: “Val1”, “Prop2”: “Val2” };

And you would like to remove one property, say “Prop1”, from the object oneObject so that it becomes defined as follows :

oneObject = { “Prop2”: “Val2” };

Read: How to remove duplicates from Arrays in Javascript

In order to do this, simply write the following code :

delete oneObject.Prop1; //remove property from object javascript

Or, if you like write also:

delete oneObject[‘Prop1’]; //Again using javascript delete


Read: Should You Learn JavaScript, Advice for Newbie Web Developers

If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.


Marianne elanotta

As a graduate in communication technologies, Marianne likes to share the latest technological advances in various fields. She likes to program in Java OO and Javascript and prefers to work on Open source operating systems. She likes to play chess and computer games in her spare time along with her 2 kids.

Leave a Reply