Oliver Eyton-Williams ee1e8abd87
feat(curriculum): restore seed + solution to Chinese (#40683)
* 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>
2021-01-12 19:31:00 -07:00

1.4 KiB

id, title, challengeType, videoUrl, forumTopicId, dashedName
id title challengeType videoUrl forumTopicId dashedName
56bbb991ad1ed5201cd392d1 更新对象属性 1 https://scrimba.com/c/c9yEJT4 18336 updating-object-properties

--description--

当你创建了一个对象后,你可以用点操作符或中括号操作符来更新对象的属性。

举个例子,让我们看看ourDog:

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

让我们更改它的名称为 "Happy Camper",这有两种方式来更新对象的name属性: ourDog.name = "Happy Camper";ourDog["name"] = "Happy Camper"; 现在,ourDog.name的值就不再是 "Camper",而是 "Happy Camper"。

--instructions--

更新myDog对象的name属性,让它的名字从 "Coder" 变成 "Happy Coder"。

--hints--

更新myDog"name"属性, 使其等于 "Happy Coder"。

assert(/happy coder/gi.test(myDog.name));

不要修改myDog的定义。

assert(/"name": "Coder"/.test(code));

--seed--

--after-user-code--

(function(z){return z;})(myDog);

--seed-contents--

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

// Only change code below this line

--solutions--

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