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
This commit is contained in:
Kristofer Koishigawa
2020-02-18 01:40:55 +09:00
committed by Mrugesh Mohapatra
parent 6a7a7e6d7d
commit b3213fc892
1264 changed files with 5635 additions and 4331 deletions

View File

@ -18,15 +18,15 @@ localeTitle: 使用concat将元素添加到数组的末尾而不是push
```yml
tests:
- text: 您的代码应使用<code>concat</code>方法。
testString: 'assert(code.match(/\.concat/g), "Your code should use the <code>concat</code> method.");'
testString: assert(code.match(/\.concat/g));
- text: 您的代码不应使用<code>push</code>方法。
testString: 'assert(!code.match(/\.push/g), "Your code should not use the <code>push</code> method.");'
testString: assert(!code.match(/\.push/g));
- text: 第<code>first</code>数组不应该改变。
testString: 'assert(JSON.stringify(first) === JSON.stringify([1, 2, 3]), "The <code>first</code> array should not change.");'
testString: assert(JSON.stringify(first) === JSON.stringify([1, 2, 3]));
- text: <code>second</code>数组不应该改变。
testString: 'assert(JSON.stringify(second) === JSON.stringify([4, 5]), "The <code>second</code> array should not change.");'
testString: assert(JSON.stringify(second) === JSON.stringify([4, 5]));
- text: '<code>nonMutatingPush([1, 2, 3], [4, 5])</code>应该返回<code>[1, 2, 3, 4, 5]</code> 。'
testString: 'assert(JSON.stringify(nonMutatingPush([1, 2, 3], [4, 5])) === JSON.stringify([1, 2, 3, 4, 5]), "<code>nonMutatingPush([1, 2, 3], [4, 5])</code> should return <code>[1, 2, 3, 4, 5]</code>.");'
testString: assert(JSON.stringify(nonMutatingPush([1, 2, 3], [4, 5])) === JSON.stringify([1, 2, 3, 4, 5]));
```

View File

@ -18,17 +18,17 @@ localeTitle: 应用函数式编程将字符串转换为URL Slugs
```yml
tests:
- text: <code>globalTitle</code>变量不应该更改。
testString: 'assert(globalTitle === "Winter Is Coming", "The <code>globalTitle</code> variable should not change.");'
testString: assert(globalTitle === "Winter Is Coming");
- text: 您的代码不应使用<code>replace</code>方法来应对此挑战。
testString: 'assert(!code.match(/\.replace/g), "Your code should not use the <code>replace</code> method for this challenge.");'
testString: assert(!code.match(/\.replace/g));
- text: <code>urlSlug(&quot;Winter Is Coming&quot;)</code>应该回归<code>&quot;winter-is-coming&quot;</code> 。
testString: 'assert(urlSlug("Winter Is Coming") === "winter-is-coming", "<code>urlSlug("Winter Is Coming")</code> should return <code>"winter-is-coming"</code>.");'
testString: assert(urlSlug("Winter Is Coming") === "winter-is-coming");
- text: <code>urlSlug(&quot; Winter Is Coming&quot;)</code>应该回归<code>&quot;winter-is-coming&quot;</code> 。
testString: 'assert(urlSlug(" Winter Is Coming") === "winter-is-coming", "<code>urlSlug(" Winter Is &nbsp;Coming")</code> should return <code>"winter-is-coming"</code>.");'
testString: assert(urlSlug(" Winter Is Coming") === "winter-is-coming");
- text: <code>urlSlug(&quot;A Mind Needs Books Like A Sword Needs A Whetstone&quot;)</code>应该回归<code>&quot;a-mind-needs-books-like-a-sword-needs-a-whetstone&quot;</code> 。
testString: 'assert(urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone") === "a-mind-needs-books-like-a-sword-needs-a-whetstone", "<code>urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone")</code> should return <code>"a-mind-needs-books-like-a-sword-needs-a-whetstone"</code>.");'
testString: assert(urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone") === "a-mind-needs-books-like-a-sword-needs-a-whetstone");
- text: <code>urlSlug(&quot;Hold The Door&quot;)</code>应该返回<code>&quot;hold-the-door&quot;</code> 。
testString: 'assert(urlSlug("Hold The Door") === "hold-the-door", "<code>urlSlug("Hold The Door")</code> should return <code>"hold-the-door"</code>.");'
testString: assert(urlSlug("Hold The Door") === "hold-the-door");
```

View File

@ -18,9 +18,9 @@ localeTitle: 使用功能编程避免突变和副作用
```yml
tests:
- text: 您的函数<code>incrementer</code>不应更改<code>fixedValue</code>的值。
testString: 'assert(fixedValue === 4, "Your function <code>incrementer</code> should not change the value of <code>fixedValue</code>.");'
testString: assert(fixedValue === 4);
- text: 您的<code>incrementer</code>函数应返回一个大于<code>fixedValue</code>值的值。
testString: 'assert(newValue === 5, "Your <code>incrementer</code> function should return a value that is one larger than the <code>fixedValue</code> value.");'
testString: assert(newValue === 5);
```

View File

@ -18,17 +18,17 @@ localeTitle: 使用join方法将Array组合成String
```yml
tests:
- text: 您的代码应使用<code>join</code>方法。
testString: 'assert(code.match(/\.join/g), "Your code should use the <code>join</code> method.");'
testString: assert(code.match(/\.join/g));
- text: 您的代码不应使用<code>replace</code>方法。
testString: 'assert(!code.match(/\.replace/g), "Your code should not use the <code>replace</code> method.");'
testString: assert(!code.match(/\.replace/g));
- text: <code>sentensify(&quot;May-the-force-be-with-you&quot;)</code>应该返回一个字符串。
testString: 'assert(typeof sentensify("May-the-force-be-with-you") === "string", "<code>sentensify("May-the-force-be-with-you")</code> should return a string.");'
testString: assert(typeof sentensify("May-the-force-be-with-you") === "string");
- text: <code>sentensify(&quot;May-the-force-be-with-you&quot;)</code>应该返回<code>&quot;May the force be with you&quot;</code> 。
testString: 'assert(sentensify("May-the-force-be-with-you") === "May the force be with you", "<code>sentensify("May-the-force-be-with-you")</code> should return <code>"May the force be with you"</code>.");'
testString: assert(sentensify("May-the-force-be-with-you") === "May the force be with you");
- text: <code>sentensify(&quot;The.force.is.strong.with.this.one&quot;)</code>应该返回<code>&quot;The force is strong with this one&quot;</code> 。
testString: 'assert(sentensify("The.force.is.strong.with.this.one") === "The force is strong with this one", "<code>sentensify("The.force.is.strong.with.this.one")</code> should return <code>"The force is strong with this one"</code>.");'
testString: assert(sentensify("The.force.is.strong.with.this.one") === "The force is strong with this one");
- text: '<code>sentensify(&quot;There,has,been,an,awakening&quot;)</code>应该回归<code>&quot;There has been an awakening&quot;</code> 。'
testString: 'assert(sentensify("There,has,been,an,awakening") === "There has been an awakening", "<code>sentensify("There,has,been,an,awakening")</code> should return <code>"There has been an awakening"</code>.");'
testString: assert(sentensify("There,has,been,an,awakening") === "There has been an awakening");
```

View File

@ -18,13 +18,13 @@ localeTitle: 使用concat方法组合两个数组
```yml
tests:
- text: 您的代码应使用<code>concat</code>方法。
testString: 'assert(code.match(/\.concat/g), "Your code should use the <code>concat</code> method.");'
testString: assert(code.match(/\.concat/g));
- text: 第<code>first</code>数组不应该改变。
testString: 'assert(JSON.stringify(first) === JSON.stringify([1, 2, 3]), "The <code>first</code> array should not change.");'
testString: assert(JSON.stringify(first) === JSON.stringify([1, 2, 3]));
- text: <code>second</code>数组不应该改变。
testString: 'assert(JSON.stringify(second) === JSON.stringify([4, 5]), "The <code>second</code> array should not change.");'
testString: assert(JSON.stringify(second) === JSON.stringify([4, 5]));
- text: '<code>nonMutatingConcat([1, 2, 3], [4, 5])</code>应该返回<code>[1, 2, 3, 4, 5]</code> 。'
testString: 'assert(JSON.stringify(nonMutatingConcat([1, 2, 3], [4, 5])) === JSON.stringify([1, 2, 3, 4, 5]), "<code>nonMutatingConcat([1, 2, 3], [4, 5])</code> should return <code>[1, 2, 3, 4, 5]</code>.");'
testString: assert(JSON.stringify(nonMutatingConcat([1, 2, 3], [4, 5])) === JSON.stringify([1, 2, 3, 4, 5]));
```

View File

@ -18,9 +18,9 @@ localeTitle: 在Prototype上实现地图
```yml
tests:
- text: '<code>new_s</code>应该等于<code>[46, 130, 196, 10]</code> <code>new_s</code> <code>[46, 130, 196, 10]</code> 。'
testString: 'assert(JSON.stringify(new_s) === JSON.stringify([46, 130, 196, 10]), "<code>new_s</code> should equal <code>[46, 130, 196, 10]</code>.");'
testString: assert(JSON.stringify(new_s) === JSON.stringify([46, 130, 196, 10]));
- text: 您的代码不应使用<code>map</code>方法。
testString: 'assert(!code.match(/\.map/g), "Your code should not use the <code>map</code> method.");'
testString: assert(!code.match(/\.map/g));
```

View File

@ -18,9 +18,9 @@ localeTitle: 在Prototype上实现过滤器方法
```yml
tests:
- text: '<code>new_s</code>应该等于<code>[23, 65, 5]</code> <code>new_s</code> <code>[23, 65, 5]</code> 。'
testString: 'assert(JSON.stringify(new_s) === JSON.stringify([23, 65, 5]), "<code>new_s</code> should equal <code>[23, 65, 5]</code>.");'
testString: assert(JSON.stringify(new_s) === JSON.stringify([23, 65, 5]));
- text: 您的代码不应使用<code>filter</code>方法。
testString: 'assert(!code.match(/\.filter/g), "Your code should not use the <code>filter</code> method.");'
testString: assert(!code.match(/\.filter/g));
```

View File

@ -18,13 +18,13 @@ localeTitle: Currying和Partial Application简介
```yml
tests:
- text: <code>add(10)(20)(30)</code>应该返回<code>60</code> 。
testString: 'assert(add(10)(20)(30) === 60, "<code>add(10)(20)(30)</code> should return <code>60</code>.");'
testString: assert(add(10)(20)(30) === 60);
- text: <code>add(1)(2)(3)</code>应该返回<code>6</code> 。
testString: 'assert(add(1)(2)(3) === 6, "<code>add(1)(2)(3)</code> should return <code>6</code>.");'
testString: assert(add(1)(2)(3) === 6);
- text: <code>add(11)(22)(33)</code>应该返回<code>66</code> 。
testString: 'assert(add(11)(22)(33) === 66, "<code>add(11)(22)(33)</code> should return <code>66</code>.");'
testString: assert(add(11)(22)(33) === 66);
- text: 您的代码应包含返回<code>x + y + z</code>的final语句。
testString: 'assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g), "Your code should include a final statement that returns <code>x + y + z</code>.");'
testString: assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g));
```

View File

@ -18,9 +18,9 @@ localeTitle: 了解功能编程
```yml
tests:
- text: <code>tea4TeamFCC</code>变量应该为团队提供40杯茶。
testString: 'assert(tea4TeamFCC.length === 40, "The <code>tea4TeamFCC</code> variable should hold 40 cups of tea for the team.");'
testString: assert(tea4TeamFCC.length === 40);
- text: <code>tea4TeamFCC</code>变量应该拿着一杯绿茶。
testString: 'assert(tea4TeamFCC[0] === "greenTea", "The <code>tea4TeamFCC</code> variable should hold cups of green tea.");'
testString: assert(tea4TeamFCC[0] === 'greenTea');
```

View File

@ -18,11 +18,11 @@ localeTitle: 传递参数以避免函数中的外部依赖
```yml
tests:
- text: 您的函数<code>incrementer</code>不应更改<code>fixedValue</code>的值。
testString: 'assert(fixedValue === 4, "Your function <code>incrementer</code> should not change the value of <code>fixedValue</code>.");'
testString: assert(fixedValue === 4);
- text: 您的<code>incrementer</code>功能应该采用参数。
testString: 'assert(code.match(/function\s+?incrementer\s*?\(.+?\)/g), "Your <code>incrementer</code> function should take a parameter.");'
testString: assert(incrementer.length === 1);
- text: 您的<code>incrementer</code>函数应返回一个大于<code>fixedValue</code>值的值。
testString: 'assert(newValue === 5, "Your <code>incrementer</code> function should return a value that is one larger than the <code>fixedValue</code> value.");'
testString: assert(newValue === 5);
```

View File

@ -18,13 +18,13 @@ localeTitle: 重构函数的全局变量
```yml
tests:
- text: '<code>bookList</code>不应该改变并且仍然相等<code>[&quot;The Hound of the Baskervilles&quot;, &quot;On The Electrodynamics of Moving Bodies&quot;, &quot;Philosophiæ Naturalis Principia Mathematica&quot;, &quot;Disquisitiones Arithmeticae&quot;]</code> 。'
testString: 'assert(JSON.stringify(bookList) === JSON.stringify(["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]), "<code>bookList</code> should not change and still equal <code>["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]</code>.");'
testString: assert(JSON.stringify(bookList) === JSON.stringify(["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]));
- text: '<code>newBookList</code>应该等于<code>[&quot;The Hound of the Baskervilles&quot;, &quot;On The Electrodynamics of Moving Bodies&quot;, &quot;Philosophiæ Naturalis Principia Mathematica&quot;, &quot;Disquisitiones Arithmeticae&quot;, &quot;A Brief History of Time&quot;]</code> 。'
testString: 'assert(JSON.stringify(newBookList) === JSON.stringify(["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]), "<code>newBookList</code> should equal <code>["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]</code>.");'
testString: assert(JSON.stringify(newBookList) === JSON.stringify(['The Hound of the Baskervilles', 'On The Electrodynamics of Moving Bodies', 'Philosophiæ Naturalis Principia Mathematica', 'Disquisitiones Arithmeticae', 'A Brief History of Time']));
- text: '<code>newerBookList</code>应该等于<code>[&quot;The Hound of the Baskervilles&quot;, &quot;Philosophiæ Naturalis Principia Mathematica&quot;, &quot;Disquisitiones Arithmeticae&quot;]</code> 。'
testString: 'assert(JSON.stringify(newerBookList) === JSON.stringify(["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]), "<code>newerBookList</code> should equal <code>["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]</code>.");'
testString: assert(JSON.stringify(newerBookList) === JSON.stringify(['The Hound of the Baskervilles', 'Philosophiæ Naturalis Principia Mathematica', 'Disquisitiones Arithmeticae']));
- text: '<code>newestBookList</code>应该等于<code>[&quot;The Hound of the Baskervilles&quot;, &quot;Philosophiæ Naturalis Principia Mathematica&quot;, &quot;Disquisitiones Arithmeticae&quot;, &quot;A Brief History of Time&quot;]</code> 。'
testString: 'assert(JSON.stringify(newestBookList) === JSON.stringify(["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]), "<code>newestBookList</code> should equal <code>["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]</code>.");'
testString: assert(JSON.stringify(newestBookList) === JSON.stringify(['The Hound of the Baskervilles', 'Philosophiæ Naturalis Principia Mathematica', 'Disquisitiones Arithmeticae', 'A Brief History of Time']));
```

View File

@ -18,13 +18,13 @@ localeTitle: 使用切片从阵列中删除元素而不是拼接
```yml
tests:
- text: 您的代码应该使用<code>slice</code>方法。
testString: 'assert(code.match(/\.slice/g), "Your code should use the <code>slice</code> method.");'
testString: assert(code.match(/\.slice/g));
- text: 您的代码不应使用<code>splice</code>方法。
testString: 'assert(!code.match(/\.splice/g), "Your code should not use the <code>splice</code> method.");'
testString: assert(!code.match(/\.splice/g));
- text: <code>inputCities</code>数组不应更改。
testString: 'assert(JSON.stringify(inputCities) === JSON.stringify(["Chicago", "Delhi", "Islamabad", "London", "Berlin"]), "The <code>inputCities</code> array should not change.");'
testString: assert(JSON.stringify(inputCities) === JSON.stringify(["Chicago", "Delhi", "Islamabad", "London", "Berlin"]));
- text: '<code>nonMutatingSplice([&quot;Chicago&quot;, &quot;Delhi&quot;, &quot;Islamabad&quot;, &quot;London&quot;, &quot;Berlin&quot;])</code>应该返回<code>[&quot;Chicago&quot;, &quot;Delhi&quot;, &quot;Islamabad&quot;]</code> 。'
testString: 'assert(JSON.stringify(nonMutatingSplice(["Chicago", "Delhi", "Islamabad", "London", "Berlin"])) === JSON.stringify(["Chicago", "Delhi", "Islamabad"]), "<code>nonMutatingSplice(["Chicago", "Delhi", "Islamabad", "London", "Berlin"])</code> should return <code>["Chicago", "Delhi", "Islamabad"]</code>.");'
testString: assert(JSON.stringify(nonMutatingSplice(["Chicago", "Delhi", "Islamabad", "London", "Berlin"])) === JSON.stringify(["Chicago", "Delhi", "Islamabad"]));
```

View File

@ -18,13 +18,13 @@ localeTitle: 返回排序数组而不更改原始数组
```yml
tests:
- text: 您的代码应该使用<code>sort</code>方法。
testString: 'assert(code.match(/\.sort/g), "Your code should use the <code>sort</code> method.");'
testString: assert(nonMutatingSort.toString().match(/\.sort/g));
- text: 您的代码应使用<code>concat</code>方法。
testString: 'assert(code.match(/\.concat/g), "Your code should use the <code>concat</code> method.");'
testString: assert(JSON.stringify(globalArray) === JSON.stringify([5, 6, 3, 2, 9]));
- text: <code>globalArray</code>变量不应该更改。
testString: 'assert(JSON.stringify(globalArray) === JSON.stringify([5, 6, 3, 2, 9]), "The <code>globalArray</code> variable should not change.");'
testString: assert(JSON.stringify(nonMutatingSort(globalArray)) === JSON.stringify([2, 3, 5, 6, 9]));
- text: '<code>nonMutatingSort(globalArray)</code>应该返回<code>[2, 3, 5, 6, 9]</code> <code>nonMutatingSort(globalArray)</code> <code>[2, 3, 5, 6, 9]</code> 。'
testString: 'assert(JSON.stringify(nonMutatingSort(globalArray)) === JSON.stringify([2, 3, 5, 6, 9]), "<code>nonMutatingSort(globalArray)</code> should return <code>[2, 3, 5, 6, 9]</code>.");'
testString: assert(!nonMutatingSort.toString().match(/[23569]/g));
```

View File

@ -18,15 +18,15 @@ localeTitle: 使用切片方法返回数组的一部分
```yml
tests:
- text: 您的代码应该使用<code>slice</code>方法。
testString: 'assert(code.match(/\.slice/g), "Your code should use the <code>slice</code> method.");'
testString: assert(code.match(/\.slice/g));
- text: <code>inputAnim</code>变量不应该更改。
testString: 'assert(JSON.stringify(inputAnim) === JSON.stringify(["Cat", "Dog", "Tiger", "Zebra", "Ant"]), "The <code>inputAnim</code> variable should not change.");'
testString: assert(JSON.stringify(inputAnim) === JSON.stringify(["Cat", "Dog", "Tiger", "Zebra", "Ant"]));
- text: '<code>sliceArray([&quot;Cat&quot;, &quot;Dog&quot;, &quot;Tiger&quot;, &quot;Zebra&quot;, &quot;Ant&quot;], 1, 3)</code>应该返回<code>[&quot;Dog&quot;, &quot;Tiger&quot;]</code> 。'
testString: 'assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 3)) === JSON.stringify(["Dog", "Tiger"]), "<code>sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 3)</code> should return <code>["Dog", "Tiger"]</code>.");'
testString: assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 3)) === JSON.stringify(["Dog", "Tiger"]));
- text: '<code>sliceArray([&quot;Cat&quot;, &quot;Dog&quot;, &quot;Tiger&quot;, &quot;Zebra&quot;, &quot;Ant&quot;], 0, 1)</code>应返回<code>[&quot;Cat&quot;]</code> 。'
testString: 'assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 0, 1)) === JSON.stringify(["Cat"]), "<code>sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 0, 1)</code> should return <code>["Cat"]</code>.");'
testString: assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 0, 1)) === JSON.stringify(["Cat"]));
- text: '<code>sliceArray([&quot;Cat&quot;, &quot;Dog&quot;, &quot;Tiger&quot;, &quot;Zebra&quot;, &quot;Ant&quot;], 1, 4)</code>应返回<code>[&quot;Dog&quot;, &quot;Tiger&quot;, &quot;Zebra&quot;]</code> 。'
testString: 'assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 4)) === JSON.stringify(["Dog", "Tiger", "Zebra"]), "<code>sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 4)</code> should return <code>["Dog", "Tiger", "Zebra"]</code>.");'
testString: assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 4)) === JSON.stringify(["Dog", "Tiger", "Zebra"]));
```

View File

@ -18,13 +18,13 @@ localeTitle: 使用sort方法按字母顺序对数组进行排序
```yml
tests:
- text: 您的代码应该使用<code>sort</code>方法。
testString: 'assert(code.match(/\.sort/g), "Your code should use the <code>sort</code> method.");'
testString: assert(code.match(/\.sort/g));
- text: '<code>alphabeticalOrder([&quot;a&quot;, &quot;d&quot;, &quot;c&quot;, &quot;a&quot;, &quot;z&quot;, &quot;g&quot;])</code>应返回<code>[&quot;a&quot;, &quot;a&quot;, &quot;c&quot;, &quot;d&quot;, &quot;g&quot;, &quot;z&quot;]</code> 。'
testString: 'assert(JSON.stringify(alphabeticalOrder(["a", "d", "c", "a", "z", "g"])) === JSON.stringify(["a", "a", "c", "d", "g", "z"]), "<code>alphabeticalOrder(["a", "d", "c", "a", "z", "g"])</code> should return <code>["a", "a", "c", "d", "g", "z"]</code>.");'
testString: assert(JSON.stringify(alphabeticalOrder(["a", "d", "c", "a", "z", "g"])) === JSON.stringify(["a", "a", "c", "d", "g", "z"]));
- text: '<code>alphabeticalOrder([&quot;x&quot;, &quot;h&quot;, &quot;a&quot;, &quot;m&quot;, &quot;n&quot;, &quot;m&quot;])</code>应返回<code>[&quot;a&quot;, &quot;h&quot;, &quot;m&quot;, &quot;m&quot;, &quot;n&quot;, &quot;x&quot;]</code> 。'
testString: 'assert(JSON.stringify(alphabeticalOrder(["x", "h", "a", "m", "n", "m"])) === JSON.stringify(["a", "h", "m", "m", "n", "x"]), "<code>alphabeticalOrder(["x", "h", "a", "m", "n", "m"])</code> should return <code>["a", "h", "m", "m", "n", "x"]</code>.");'
testString: assert(JSON.stringify(alphabeticalOrder(["x", "h", "a", "m", "n", "m"])) === JSON.stringify(["a", "h", "m", "m", "n", "x"]));
- text: '<code>alphabeticalOrder([&quot;a&quot;, &quot;a&quot;, &quot;a&quot;, &quot;a&quot;, &quot;x&quot;, &quot;t&quot;])</code>应返回<code>[&quot;a&quot;, &quot;a&quot;, &quot;a&quot;, &quot;a&quot;, &quot;t&quot;, &quot;x&quot;]</code> 。'
testString: 'assert(JSON.stringify(alphabeticalOrder(["a", "a", "a", "a", "x", "t"])) === JSON.stringify(["a", "a", "a", "a", "t", "x"]), "<code>alphabeticalOrder(["a", "a", "a", "a", "x", "t"])</code> should return <code>["a", "a", "a", "a", "t", "x"]</code>.");'
testString: assert(JSON.stringify(alphabeticalOrder(["a", "a", "a", "a", "x", "t"])) === JSON.stringify(["a", "a", "a", "a", "t", "x"]));
```

View File

@ -18,13 +18,13 @@ localeTitle: 使用split方法将字符串拆分为数组
```yml
tests:
- text: 您的代码应该使用<code>split</code>方法。
testString: 'assert(code.match(/\.split/g), "Your code should use the <code>split</code> method.");'
testString: assert(code.match(/\.split/g));
- text: '<code>splitify(&quot;Hello World,I-am code&quot;)</code>应返回<code>[&quot;Hello&quot;, &quot;World&quot;, &quot;I&quot;, &quot;am&quot;, &quot;code&quot;]</code> 。'
testString: 'assert(JSON.stringify(splitify("Hello World,I-am code")) === JSON.stringify(["Hello", "World", "I", "am", "code"]), "<code>splitify("Hello World,I-am code")</code> should return <code>["Hello", "World", "I", "am", "code"]</code>.");'
testString: assert(JSON.stringify(splitify("Hello World,I-am code")) === JSON.stringify(["Hello", "World", "I", "am", "code"]));
- text: '<code>splitify(&quot;Earth-is-our home&quot;)</code>应该返回<code>[&quot;Earth&quot;, &quot;is&quot;, &quot;our&quot;, &quot;home&quot;]</code> 。'
testString: 'assert(JSON.stringify(splitify("Earth-is-our home")) === JSON.stringify(["Earth", "is", "our", "home"]), "<code>splitify("Earth-is-our home")</code> should return <code>["Earth", "is", "our", "home"]</code>.");'
testString: assert(JSON.stringify(splitify("Earth-is-our home")) === JSON.stringify(["Earth", "is", "our", "home"]));
- text: '<code>splitify(&quot;This.is.a-sentence&quot;)</code>应该返回<code>[&quot;This&quot;, &quot;is&quot;, &quot;a&quot;, &quot;sentence&quot;]</code> 。'
testString: 'assert(JSON.stringify(splitify("This.is.a-sentence")) === JSON.stringify(["This", "is", "a", "sentence"]), "<code>splitify("This.is.a-sentence")</code> should return <code>["This", "is", "a", "sentence"]</code>.");'
testString: assert(JSON.stringify(splitify("This.is.a-sentence")) === JSON.stringify(["This", "is", "a", "sentence"]));
```

View File

@ -18,13 +18,13 @@ localeTitle: 理解功能编程术语
```yml
tests:
- text: <code>tea4GreenTeamFCC</code>变量应该为团队提供27杯绿茶。
testString: 'assert(tea4GreenTeamFCC.length === 27, "The <code>tea4GreenTeamFCC</code> variable should hold 27 cups of green tea for the team.");'
testString: assert(tea4GreenTeamFCC.length === 27);
- text: <code>tea4GreenTeamFCC</code>变量应该拿着一杯绿茶。
testString: 'assert(tea4GreenTeamFCC[0] === "greenTea", "The <code>tea4GreenTeamFCC</code> variable should hold cups of green tea.");'
testString: assert(tea4GreenTeamFCC[0] === 'greenTea');
- text: <code>tea4BlackTeamFCC</code>变量应该可以容纳13杯红茶。
testString: 'assert(tea4BlackTeamFCC.length === 13, "The <code>tea4BlackTeamFCC</code> variable should hold 13 cups of black tea.");'
testString: assert(tea4BlackTeamFCC.length === 13);
- text: <code>tea4BlackTeamFCC</code>变量应该拿着一杯红茶。
testString: 'assert(tea4BlackTeamFCC[0] === "blackTea", "The <code>tea4BlackTeamFCC</code> variable should hold cups of black tea.");'
testString: assert(tea4BlackTeamFCC[0] === 'blackTea');
```

View File

@ -19,7 +19,7 @@ localeTitle: 了解使用命令代码的危害
```yml
tests:
- text: 继续前进以了解错误。
testString: 'assert(true, "Move ahead to understand the error.");'
testString: assert.deepEqual(finalTabs.tabs, ['FB', 'Gitter', 'Reddit', 'Twitter', 'Medium', 'new tab', 'Netflix', 'YouTube', 'Vine', 'GMail', 'Work mail', 'Docs', 'freeCodeCamp', 'new tab'])
```

View File

@ -18,13 +18,13 @@ localeTitle: 使用every方法检查数组中的每个元素是否符合条件
```yml
tests:
- text: 您的代码应该使用<code>every</code>方法。
testString: 'assert(code.match(/\.every/g), "Your code should use the <code>every</code> method.");'
testString: assert(code.match(/\.every/g));
- text: '<code>checkPositive([1, 2, 3, -4, 5])</code>应该返回<code>false</code> 。'
testString: 'assert(!checkPositive([1, 2, 3, -4, 5]), "<code>checkPositive([1, 2, 3, -4, 5])</code> should return <code>false</code>.");'
testString: assert.isFalse(checkPositive([1, 2, 3, -4, 5]));
- text: '<code>checkPositive([1, 2, 3, 4, 5])</code>应该返回<code>true</code> 。'
testString: 'assert(checkPositive([1, 2, 3, 4, 5]), "<code>checkPositive([1, 2, 3, 4, 5])</code> should return <code>true</code>.");'
testString: assert.isTrue(checkPositive([1, 2, 3, 4, 5]));
- text: '<code>checkPositive([1, -2, 3, -4, 5])</code>应该返回<code>false</code> 。'
testString: 'assert(!checkPositive([1, -2, 3, -4, 5]), "<code>checkPositive([1, -2, 3, -4, 5])</code> should return <code>false</code>.");'
testString: assert.isFalse(checkPositive([1, -2, 3, -4, 5]));
```

View File

@ -18,13 +18,13 @@ localeTitle: 使用过滤器方法从数组中提取数据
```yml
tests:
- text: <code>watchList</code>变量不应该更改。
testString: 'assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron", "The <code>watchList</code> variable should not change.");'
testString: assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron");
- text: 您的代码应该使用<code>filter</code>方法。
testString: 'assert(code.match(/\.filter/g), "Your code should use the <code>filter</code> method.");'
testString: assert(code.match(/\.filter/g));
- text: 您的代码不应使用<code>for</code>循环。
testString: 'assert(!code.match(/for\s*?\(.+?\)/g), "Your code should not use a <code>for</code> loop.");'
testString: assert(!code.match(/for\s*?\([\s\S]*?\)/g));
- text: '<code>filteredList</code>应该等于<code>[{&quot;title&quot;: &quot;Inception&quot;,&quot;rating&quot;: &quot;8.8&quot;},{&quot;title&quot;: &quot;Interstellar&quot;,&quot;rating&quot;: &quot;8.6&quot;},{&quot;title&quot;: &quot;The Dark Knight&quot;,&quot;rating&quot;: &quot;9.0&quot;},{&quot;title&quot;: &quot;Batman Begins&quot;,&quot;rating&quot;: &quot;8.3&quot;}]</code> 。'
testString: 'assert.deepEqual(filteredList, [{"title": "Inception","rating": "8.8"},{"title": "Interstellar","rating": "8.6"},{"title": "The Dark Knight","rating": "9.0"},{"title": "Batman Begins","rating": "8.3"}], "<code>filteredList</code> should equal <code>[{"title": "Inception","rating": "8.8"},{"title": "Interstellar","rating": "8.6"},{"title": "The Dark Knight","rating": "9.0"},{"title": "Batman Begins","rating": "8.3"}]</code>.");'
testString: 'assert.deepEqual(filteredList, [{"title": "Inception","rating": "8.8"},{"title": "Interstellar","rating": "8.6"},{"title": "The Dark Knight","rating": "9.0"},{"title": "Batman Begins","rating": "8.3"}]);'
```

View File

@ -18,13 +18,13 @@ localeTitle: 使用映射方法从数组中提取数据
```yml
tests:
- text: <code>watchList</code>变量不应该更改。
testString: 'assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron", "The <code>watchList</code> variable should not change.");'
testString: assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron");
- text: 您的代码不应使用<code>for</code>循环。
testString: 'assert(!code.match(/for\s*?\(.+?\)/g), "Your code should not use a <code>for</code> loop.");'
testString: assert(!removeJSComments(code).match(/for\s*?\([\s\S]*?\)/));
- text: 您的代码应该使用<code>map</code>方法。
testString: 'assert(code.match(/\.map/g), "Your code should use the <code>map</code> method.");'
testString: assert(code.match(/\.map/g));
- text: '<code>rating</code>应该等于<code>[{&quot;title&quot;:&quot;Inception&quot;,&quot;rating&quot;:&quot;8.8&quot;},{&quot;title&quot;:&quot;Interstellar&quot;,&quot;rating&quot;:&quot;8.6&quot;},{&quot;title&quot;:&quot;The Dark Knight&quot;,&quot;rating&quot;:&quot;9.0&quot;},{&quot;title&quot;:&quot;Batman Begins&quot;,&quot;rating&quot;:&quot;8.3&quot;},{&quot;title&quot;:&quot;Avatar&quot;,&quot;rating&quot;:&quot;7.9&quot;}]</code> 。'
testString: 'assert(JSON.stringify(rating) === JSON.stringify([{"title":"Inception","rating":"8.8"},{"title":"Interstellar","rating":"8.6"},{"title":"The Dark Knight","rating":"9.0"},{"title":"Batman Begins","rating":"8.3"},{"title":"Avatar","rating":"7.9"}]), "<code>rating</code> should equal <code>[{"title":"Inception","rating":"8.8"},{"title":"Interstellar","rating":"8.6"},{"title":"The Dark Knight","rating":"9.0"},{"title":"Batman Begins","rating":"8.3"},{"title":"Avatar","rating":"7.9"}]</code>.");'
testString: assert.deepEqual(ratings, [{"title":"Inception","rating":"8.8"},{"title":"Interstellar","rating":"8.6"},{"title":"The Dark Knight","rating":"9.0"},{"title":"Batman Begins","rating":"8.3"},{"title":"Avatar","rating":"7.9"}]);
```

View File

@ -18,13 +18,13 @@ localeTitle: 使用某些方法检查阵列中的任何元素是否符合条件
```yml
tests:
- text: 您的代码应该使用<code>some</code>方法。
testString: 'assert(code.match(/\.some/g), "Your code should use the <code>some</code> method.");'
testString: assert(code.match(/\.some/g));
- text: '<code>checkPositive([1, 2, 3, -4, 5])</code>应该返回<code>true</code> 。'
testString: 'assert(checkPositive([1, 2, 3, -4, 5]), "<code>checkPositive([1, 2, 3, -4, 5])</code> should return <code>true</code>.");'
testString: assert(checkPositive([1, 2, 3, -4, 5]));
- text: '<code>checkPositive([1, 2, 3, 4, 5])</code>应该返回<code>true</code> 。'
testString: 'assert(checkPositive([1, 2, 3, 4, 5]), "<code>checkPositive([1, 2, 3, 4, 5])</code> should return <code>true</code>.");'
testString: assert(checkPositive([1, 2, 3, 4, 5]));
- text: '<code>checkPositive([-1, -2, -3, -4, -5])</code>应该返回<code>false</code> 。'
testString: 'assert(!checkPositive([-1, -2, -3, -4, -5]), "<code>checkPositive([-1, -2, -3, -4, -5])</code> should return <code>false</code>.");'
testString: assert(!checkPositive([-1, -2, -3, -4, -5]));
```