Remove a Property from a JavaScript Object

  215 views   7 months ago Javascript

Javascript object is pair of key/value. If you want to access any value from the Javscript object, you can access using object.key or object['key'] syntax.

In this article we will share how you can remove any property from the Javscript object. 

Here is below code to remove property from the Javscript object.

var person = {
    firstName: "John",
    lastName: "Doe",
    email: "^[email protected]"
};
delete person.email;

// or another way
delete person['email'];

console.log(person);

This way you can remove property from Javascript object.

Thank you for giving time to read the article. I hope you like this article.

Author : Harsukh Makwana
Harsukh Makwana

Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]