Home > database >  Remove an element from an object
Remove an element from an object

Time:08-17

My code is,

let data={type:1, name:"tye", address:"hbjh454"}

I want this object like,

let data={ name:"tye", address:"hbjh454"}

I need to Remove type from this object

CodePudding user response:

You can use the delete operator

let data = { type: 1, name: "tye", address: "hbjh454" };

delete data.type;

console.log(data);

  • Related