Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

remove from object javascript

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' }
 
PREVIOUS NEXT
Tagged: #remove #object #javascript
ADD COMMENT
Topic
Name
5+6 =