Deleting Properties of object in javascript

 The delete keyword deletes a property from an object:


const person = {

  firstname: "John",

  lastname: "Doe",

  age: 50,

  eyecolor: "blue"

};



delete person.age;

console.log(person);


//output

{ firstname: 'John', lastname: 'Doe', eyecolor: 'blue' }

Comments

Popular posts from this blog

Two Sum II - Input Array Is Sorted

Comparable Vs. Comparator in Java

Increasing Triplet Subsequence