const employee = {
id:1,
name: 'ofir',
salary: 1000
};
const {salary, ...newEmployee } = employee;
console.log( newEmployee );
// { id: 1, name: 'ofir' }
/***** OR ******/
delete employee.salary;
console.log( employee );
// { id: 1, name: 'ofir' }
delete object.element
var obj = {
func: function(a, b) {
return a + b;
}
};
delete obj.func;
obj.func(); // Uncaught TypeError: obj.func is not a function
delete object in javascript
remove element from an object