freeCodeCamp/curriculum/challenges/russian/02-javascript-algorithms-an.../object-oriented-programming/use-dot-notation-to-access-...

2.2 KiB
Raw Blame History

id title challengeType videoUrl localeTitle
587d7dac367417b2b2512b74 Use Dot Notation to Access the Properties of an Object 1 Использовать точную нотацию для доступа к свойствам объекта

Description

Последняя задача создала object с различными properties , теперь вы увидите, как получить доступ к значениям этих properties . Вот пример:
let duck = {
имя: «Афлак»,
numLegs: 2
};
console.log (duck.name);
// Это печатает «Aflac» на консоли
Точечная нотация используется для имени object , duck , а затем имя property , name , для доступа к значению «Aflac».

Instructions

Распечатайте оба properties объекта dog ниже на консоль.

Tests

tests:
  - text: Вы должны использовать <code>console.log</code> для печати значения для <code>name</code> свойства <code>dog</code> объекта.
    testString: 'assert(/console.log\(.*dog\.name.*\)/g.test(code), "Your should use <code>console.log</code> to print the value for the <code>name</code> property of the <code>dog</code> object.");'
  - text: Для использования значения свойства <code>numLegs</code> объекта <code>dog</code> следует использовать <code>console.log</code> .
    testString: 'assert(/console.log\(.*dog\.numLegs.*\)/g.test(code), "Your should use <code>console.log</code> to print the value for the <code>numLegs</code> property of the <code>dog</code> object.");'

Challenge Seed

let dog = {
  name: "Spot",
  numLegs: 4
};
// Add your code below this line

Solution

// solution required