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.3 KiB

id, title, challengeType, videoUrl, forumTopicId, dashedName
id title challengeType videoUrl forumTopicId dashedName
56bbb991ad1ed5201cd392ce 使用 unshift() 操作数组 1 https://scrimba.com/c/ckNDESv 18239 manipulate-arrays-with-unshift

--description--

你不仅可以shift(移出)数组中的第一个元素,你也可以unshift(移入)一个元素到数组的头部。

.unshift()函数用起来就像.push()函数一样, 但不是在数组的末尾添加元素,而是在数组的头部添加元素。

--instructions--

使用unshift()函数把["Paul",35]加入到myArray的头部。

--hints--

myArray应该包含"Paul", 35], ["dog", 3

assert(
  (function (d) {
    if (
      typeof d[0] === 'object' &&
      d[0][0] == 'Paul' &&
      d[0][1] === 35 &&
      d[1][0] != undefined &&
      d[1][0] == 'dog' &&
      d[1][1] != undefined &&
      d[1][1] == 3
    ) {
      return true;
    } else {
      return false;
    }
  })(myArray)
);

--seed--

--after-user-code--

(function(y, z){return 'myArray = ' + JSON.stringify(y);})(myArray);

--seed-contents--

// Setup
var myArray = [["John", 23], ["dog", 3]];
myArray.shift();

// Only change code below this line

--solutions--

var myArray = [["John", 23], ["dog", 3]];
myArray.shift();
myArray.unshift(["Paul", 35]);