Tag Archives: Information Technology

How can we remove a property from a JavaScript object?

Objects are one of the essential building blocks of JavaScript Language. You simply can’t have an application that does not make use of Javascript Objects.

We will checkout how to remove a property from a JavaScript object that you already have defined.

Consider you have defined an Object employee as: 

var employee = {

    “name”: “John Doe”,

    “age”: 25,

    “salary”: 35000,

    “department”: “sales”

};

You want to remove property named “department” from employee object. You can do this with delete statement as:

delete employee.department;

Advertisement