freeCodeCamp/curriculum/challenges/russian/02-javascript-algorithms-an.../basic-javascript/delete-properties-from-a-ja...

1.7 KiB
Raw Blame History

id title challengeType videoUrl localeTitle
56bbb991ad1ed5201cd392d3 Delete Properties from a JavaScript Object 1 Удаление свойств из объекта JavaScript

Description

Мы также можем удалить свойства из таких объектов: delete ourDog.bark;

Instructions

Удалите свойство "tails" из myDog . Вы можете использовать либо точечную, либо скобку.

Tests

tests:
  - text: Удалите свойство <code>&quot;tails&quot;</code> из <code>myDog</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