foods
object example one last time. If we wanted to remove the apples
key, we can remove it by using the delete
keyword like this:
```js
delete foods.apples;
```
oranges
, plums
, and strawberries
keys from the foods
object.
foods
object only has three keys: apples
, grapes
, and bananas
'
testString: 'assert(!foods.hasOwnProperty(''oranges'') && !foods.hasOwnProperty(''plums'') && !foods.hasOwnProperty(''strawberries'') && Object.keys(foods).length === 3);'
- text: The oranges
, plums
, and strawberries
keys are removed using delete
testString: assert(code.search(/oranges:/) !== -1 && code.search(/plums:/) !== -1 && code.search(/strawberries:/) !== -1);
```