Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

delete certain property from object in javascript

/*The JavaScript delete operator removes a property from an object;
*/
const Employee = {
  firstname: 'John',
  lastname: 'Doe'
};

console.log(Employee.firstname);
// expected output: "John"

delete Employee.firstname;

console.log(Employee.firstname);
// expected output: undefined
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #delete #property #object #javascript
ADD COMMENT
Topic
Name
1+8 =