* feat(tools): add seed/solution restore script * chore(curriculum): remove empty sections' markers * chore(curriculum): add seed + solution to Chinese * chore: remove old formatter * fix: update getChallenges parse translated challenges separately, without reference to the source * chore(curriculum): add dashedName to English * chore(curriculum): add dashedName to Chinese * refactor: remove unused challenge property 'name' * fix: relax dashedName requirement * fix: stray tag Remove stray `pre` tag from challenge file. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
1.4 KiB
1.4 KiB
id, title, challengeType, videoUrl, forumTopicId, dashedName
id | title | challengeType | videoUrl | forumTopicId | dashedName |
---|---|---|---|---|---|
56bbb991ad1ed5201cd392d3 | Delete Properties from a JavaScript Object | 1 | https://scrimba.com/c/cDqKdTv | 17560 | delete-properties-from-a-javascript-object |
--description--
We can also delete properties from objects like this:
delete ourDog.bark;
Example:
var ourDog = {
"name": "Camper",
"legs": 4,
"tails": 1,
"friends": ["everything!"],
"bark": "bow-wow"
};
delete ourDog.bark;
After the last line shown above, ourDog
looks like:
{
"name": "Camper",
"legs": 4,
"tails": 1,
"friends": ["everything!"]
}
--instructions--
Delete the "tails"
property from myDog
. You may use either dot or bracket notation.
--hints--
You should delete the property "tails"
from myDog
.
assert(typeof myDog === 'object' && myDog.tails === undefined);
You should not modify the myDog
setup.
assert(code.match(/"tails": 1/g).length > 0);
--seed--
--after-user-code--
(function(z){return z;})(myDog);
--seed-contents--
// Setup
var myDog = {
"name": "Happy Coder",
"legs": 4,
"tails": 1,
"friends": ["freeCodeCamp Campers"],
"bark": "woof"
};
// Only change code below this line
--solutions--
var myDog = {
"name": "Happy Coder",
"legs": 4,
"tails": 1,
"friends": ["freeCodeCamp Campers"],
"bark": "woof"
};
delete myDog.tails;