Kristofer Koishigawa b3213fc892 fix(i18n): chinese test suite (#38220)
* fix: Chinese test suite

Add localeTiltes, descriptions, and adjust test text and testStrings to get the automated test suite working.

* fix: ran script, updated testStrings and solutions
2020-03-03 18:49:47 +05:30

1.7 KiB
Raw Blame History

id, title, challengeType, videoUrl, localeTitle
id title challengeType videoUrl localeTitle
56bbb991ad1ed5201cd392d2 Add New Properties to a JavaScript Object 1 将新属性添加到JavaScript对象

Description

您可以像修改现有JavaScript对象一样向现有JavaScript对象添加新属性。以下是我们如何为ourDog添加"bark"属性: ourDog.bark = "bow-wow";或者我们的ourDog["bark"] = "bow-wow";现在当我们评估我们的ourDog.bark ,我们会得到他的吠声,“低头哇”。

Instructions

myDog添加"bark"属性并将其设置为狗声例如“woof”。您可以使用点或括号表示法。

Tests

tests:
  - text: 将属性<code>&quot;bark&quot;</code>添加到<code>myDog</code> 。
    testString: assert(myDog.bark !== undefined);
  - text: 不要在设置部分添加<code>&quot;bark&quot;</code>
    testString: assert(!/bark[^\n]:/.test(code));

Challenge Seed

// Example
var ourDog = {
  "name": "Camper",
  "legs": 4,
  "tails": 1,
  "friends": ["everything!"]
};

ourDog.bark = "bow-wow";

// Setup
var myDog = {
  "name": "Happy Coder",
  "legs": 4,
  "tails": 1,
  "friends": ["freeCodeCamp Campers"]
};

// Only change code below this line.

After Test

console.info('after the test');

Solution

// solution required