Js
js 对象属性删除
方法
delete 对象.属性
说明:删除对象的某个属性
示例
const person = {
firstname: '张',
lastname: '三'
}
console.log(person);
// expected output: { firstname: '张', lastname: '三'}
delete person.firstname;
console.log(person);
// expected output: {lastname: '三'}
你也可以
delete person['firstname'];