How to remove a property from a JavaScript object?

Deleting a property from JavaScript object quite straight forward. We can use the delete keyword to delete a property of a JavaScript object.

Lets consider we have following object:

var obj = {
   name: "Joe Smith",
   status: "Active",
   email: "joe@example.com"
}

Now we want to delete the property called status, we can simply do the following to do it:

var obj = {
   name: "Joe Smith",
   status: "Active",
   email: "joe@example.com"
}

delete obj.status;
delete obj["status"];
Share