Oliver Eyton-Williams 0bd52f8bd1
Feat: add new Markdown parser (#39800)
and change all the challenges to new `md` format.
2020-11-27 10:02:05 -08:00

1.3 KiB

id, title, challengeType, videoUrl, forumTopicId
id title challengeType videoUrl forumTopicId
56bbb991ad1ed5201cd392d3 Delete Properties from a JavaScript Object 1 https://scrimba.com/c/cDqKdTv 17560

--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;