foods对象示例。如果我们想删除apples键,我们可以使用delete关键字删除它,如下所示: 删除foods.apples;
foods对象中删除oranges , plums和strawberries键。 foods对象只有三个键: apples , grapes和bananas
testString: 'assert(!foods.hasOwnProperty("oranges") && !foods.hasOwnProperty("plums") && !foods.hasOwnProperty("strawberries") && Object.keys(foods).length === 3, "The foods object only has three keys: apples, grapes, and bananas");'
- text: 使用delete oranges , plums和strawberries键
testString: 'assert(code.search(/oranges:/) !== -1 && code.search(/plums:/) !== -1 && code.search(/strawberries:/) !== -1, "The oranges, plums, and strawberries keys are removed using delete");'
```