javascript运算符
The delete
JavaScript operator is used to delete a property from an object.
delete
JavaScript运算符用于从对象中删除属性。
Say you have this object:
说你有这个对象:
const car = {
model: 'Fiesta',
color: 'green'
}
You can delete any property from it, or method, using the delete
operator:
您可以使用delete
运算符从其属性或方法中删除任何属性:
delete car.model
You can also reference the property/method using the brackets syntax:
您也可以使用方括号语法引用属性/方法:
delete car['color']
javascript运算符