foods
对象。如果我们想移除apples
属性,我们可以使用delete
关键字:
```js
delete foods.apples;
```
foods
中的oranges
、plums
和strawberries
属性。
foods
对象应该只含有 3 个键:apples
、grapes
和bananas
。
testString: 'assert(!foods.hasOwnProperty(''oranges'') && !foods.hasOwnProperty(''plums'') && !foods.hasOwnProperty(''strawberries'') && Object.keys(foods).length === 3);'
- text: 你应该用delete
关键字来移除oranges
、plums
和strawberries
属性。
testString: assert(code.search(/oranges:/) !== -1 && code.search(/plums:/) !== -1 && code.search(/strawberries:/) !== -1);
```