Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

remove 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: #remove #property #object #javascript
ADD COMMENT
Topic
Name
7+9 =