1.5 KiB
1.5 KiB
id, title, challengeType, videoUrl, localeTitle
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
56bbb991ad1ed5201cd392d3 | Delete Properties from a JavaScript Object | 1 | 从JavaScript对象中删除属性 |
Description
delete ourDog.bark;
Instructions
myDog
删除"tails"
属性。您可以使用点或括号表示法。 Tests
tests:
- text: 从<code>myDog</code>删除属性<code>"tails"</code> 。
testString: 'assert(typeof myDog === "object" && myDog.tails === undefined, "Delete the property <code>"tails"</code> from <code>myDog</code>.");'
- text: 不要修改<code>myDog</code>设置
testString: 'assert(code.match(/"tails": 1/g).length > 1, "Do not modify the <code>myDog</code> setup");'
Challenge Seed
// Example
var ourDog = {
"name": "Camper",
"legs": 4,
"tails": 1,
"friends": ["everything!"],
"bark": "bow-wow"
};
delete ourDog.bark;
// Setup
var myDog = {
"name": "Happy Coder",
"legs": 4,
"tails": 1,
"friends": ["freeCodeCamp Campers"],
"bark": "woof"
};
// Only change code below this line.
After Test
console.info('after the test');
Solution
// solution required