diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-using-sufficient-contrast.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-using-sufficient-contrast.chinese.md
index 70cec22767..5c7770e5f5 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-using-sufficient-contrast.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-using-sufficient-contrast.chinese.md
@@ -26,9 +26,9 @@ Camper Cat 正在尝试为他的博客文本与背景使用颜色,但是他目
```yml
tests:
- text: '你应该将color
属性的亮度值设置为 15%。'
- testString: 'assert(code.match(/color:\s*?hsl\(0,\s*?55%,\s*?15%\)/gi));'
+ testString: assert(code.match(/color:\s*?hsl\(0,\s*?55%,\s*?15%\)/gi));
- text: '你应该将background-color
属性的亮度值设置为 55%。'
- testString: 'assert(code.match(/background-color:\s*?hsl\(120,\s*?25%,\s*?55%\)/gi));'
+ testString: assert(code.match(/background-color:\s*?hsl\(120,\s*?25%,\s*?55%\)/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/improve-accessibility-of-audio-content-with-the-audio-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/improve-accessibility-of-audio-content-with-the-audio-element.chinese.md
index d8ccd9abab..5167a09d55 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/improve-accessibility-of-audio-content-with-the-audio-element.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/improve-accessibility-of-audio-content-with-the-audio-element.chinese.md
@@ -45,7 +45,7 @@ tests:
- text: 'source
标签应该在audio
标签中。'
testString: assert($('audio').children('source').length === 1);
- text: 'source
标签中src
属性的值应该与教程中的链接一致。'
- testString: 'assert($(''source'').attr(''src'') === ''https://s3.amazonaws.com/freecodecamp/screen-reader.mp3'');'
+ testString: assert($('source').attr('src') === 'https://s3.amazonaws.com/freecodecamp/screen-reader.mp3');
- text: 'source
标签中应具有type
属性,其值为 audio/mpeg。'
testString: assert($('source').attr('type') === 'audio/mpeg');
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-elements-only-visible-to-a-screen-reader-by-using-custom-css.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-elements-only-visible-to-a-screen-reader-by-using-custom-css.chinese.md
index df5bd11b2f..eba5e702d0 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-elements-only-visible-to-a-screen-reader-by-using-custom-css.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-elements-only-visible-to-a-screen-reader-by-using-custom-css.chinese.md
@@ -46,9 +46,9 @@ tests:
- text: 'sr-only
类中的left
属性的值应为 -10000px。'
testString: assert($('.sr-only').css('left') == '-10000px');
- text: 'sr-only
类中的width
属性的值应为 1px。'
- testString: 'assert(code.match(/width:\s*?1px/gi));'
+ testString: assert(code.match(/width:\s*?1px/gi));
- text: 'sr-only
类中的height
属性的值应为 1px。'
- testString: 'assert(code.match(/height:\s*?1px/gi));'
+ testString: assert(code.match(/height:\s*?1px/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-links-navigable-with-html-access-keys.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-links-navigable-with-html-access-keys.chinese.md
index 31c87c3be2..7caf0280b6 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-links-navigable-with-html-access-keys.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-links-navigable-with-html-access-keys.chinese.md
@@ -32,7 +32,7 @@ tests:
- text: '你应该将id
是 "first" 的a
标签的accesskey
属性值设置为小写 "g"。'
testString: assert($('#first').attr('accesskey') == 'g');
- text: '你应该将id
是 "second" 的a
标签的accesskey
属性值设置为小写 "c"。'
- testString: assert($('#second').attr('accesskey') == 'c')
+ testString: assert($('#second').attr('accesskey') == 'c');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/standardize-times-with-the-html5-datetime-attribute.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/standardize-times-with-the-html5-datetime-attribute.chinese.md
index d539b2b7b2..9fa8217416 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/standardize-times-with-the-html5-datetime-attribute.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/standardize-times-with-the-html5-datetime-attribute.chinese.md
@@ -25,13 +25,13 @@ Camper Cat 的比武大会的时间确定了!请使用time
标签
```yml
tests:
- text: 'time
标签应该包含文本"Thursday, September 15<sup>th</sup>"。'
- testString: assert($('time').text().match(/Thursday, September 15th/g));
+ testString: assert(timeElement.length);
- text: 'time
标签应该有 1 个非空的datetime
属性。'
- testString: assert($('time').attr('datetime'));
+ testString: assert(timeElement.length && $(timeElement).html().trim() === "Thursday, September 15th");
- text: 'datetime
属性的值应该为 2016-09-15。'
- testString: assert($('time').attr('datetime') === "2016-09-15");
+ testString: assert(datetimeAttr && datetimeAttr.length);
- text: '确保time
标签是闭合的。'
- testString: assert(code.match(/<\/time>/g) && code.match(/<\/time>/g).length === 4);
+ testString: assert(datetimeAttr === "2016-09-15");
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/use-headings-to-show-hierarchical-relationships-of-content.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/use-headings-to-show-hierarchical-relationships-of-content.chinese.md
index 7e816d46c7..63d8803cd6 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/use-headings-to-show-hierarchical-relationships-of-content.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/use-headings-to-show-hierarchical-relationships-of-content.chinese.md
@@ -28,9 +28,9 @@ Camper Cat 希望他的网站有一个介绍如何成为忍者的页面。请帮
```yml
tests:
- text: '你的代码应该包含 6 个h3
标签。'
- testString: assert($('h3').length === 6);
+ testString: assert($("h3").length === 6);
- text: '你的代码不应包含 h5
标签。'
- testString: assert($('h5').length === 0);
+ testString: assert((code.match(/\/h3/g) || []).length===6);
- text: '代码不应该包含 h5
标记.'
testString: assert($("h5").length === 0);
- text: '代码不应该包含 h5
结束标记。'
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/add-a-box-shadow-to-a-card-like-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/add-a-box-shadow-to-a-card-like-element.chinese.md
index c2d79b55c2..b50e4bdd6d 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/add-a-box-shadow-to-a-card-like-element.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/add-a-box-shadow-to-a-card-like-element.chinese.md
@@ -39,9 +39,9 @@ box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
```yml
tests:
- text: '你应该给 id 为 thumbnail
的元素添加 box-shadow
属性。'
- testString: assert(code.match(/#thumbnail\s*?{\s*?box-shadow/g), '你应该给 id 为 thumbnail
的元素添加 box-shadow
属性。');
+ testString: assert(code.match(/#thumbnail\s*?{\s*?box-shadow/g));
- text: 'box-shadow
值应该是指定的 CSS 值。'
- testString: 'assert(code.match(/box-shadow:\s*?0\s+?10px\s+?20px\s+?rgba\(\s*?0\s*?,\s*?0\s*?,\s*?0\s*?,\s*?0?\.19\),\s*?0\s+?6px\s+?6px\s+?rgba\(\s*?0\s*?,\s*?0\s*?,\s*?0\s*?,\s*?0?\.23\)/gi), ''box-shadow
值应该是指定的 CSS 值。'');'
+ testString: assert(code.match(/box-shadow:\s*?0\s+?10px\s+?20px\s+?rgba\(\s*?0\s*?,\s*?0\s*?,\s*?0\s*?,\s*?0?\.19\)\s*?,\s*?0\s+?6px\s+?6px\s+?rgba\(\s*?0\s*?,\s*?0\s*?,\s*?0\s*?,\s*?0?\.23\)/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-background-color-property-of-text.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-background-color-property-of-text.chinese.md
index cdbdb20859..b1750825a2 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-background-color-property-of-text.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-background-color-property-of-text.chinese.md
@@ -27,11 +27,11 @@ RGB 值可以在 0 到 255 之间。alpha 值可以在 0 到 1 之间,其中 0
```yml
tests:
- text: '你应该给 h4
元素添加一个 background-color
属性并且赋值 rgba(45, 45, 45, 0.1)
。'
- testString: 'assert(code.match(/background-color:\s*?rgba\(\s*?45\s*?,\s*?45\s*?,\s*?45\s*?,\s*?0?\.1\s*?\)/gi), ''你应该给 h4
元素添加一个 background-color
属性并且赋值 rgba(45, 45, 45, 0.1)
。'');'
+ testString: assert(code.match(/(background-color|background):\s*?rgba\(\s*?45\s*?,\s*?45\s*?,\s*?45\s*?,\s*?0?\.1\s*?\);/gi));
- text: '你应该给 h4
元素添加一个 padding
属性并且赋值 10px
。'
- testString: assert($('h4').css('padding-top') == '10px' && $('h4').css('padding-right') == '10px' && $('h4').css('padding-bottom') == '10px' && $('h4').css('padding-left') == '10px', '你应该给 h4
元素添加一个 padding
属性并且赋值 10px
。');
+ testString: assert($('h4').css('padding-top') == '10px' && $('h4').css('padding-right') == '10px' && $('h4').css('padding-bottom') == '10px' && $('h4').css('padding-left') == '10px');
- text: 'h4
元素的 height
属性应该被移除。'
- testString: assert(!($('h4').css('height') == '25px'), 'h4
元素的 height
属性应该被移除。');
+ testString: assert(!($('h4').css('height') == '25px'));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-color-of-various-elements-to-complementary-colors.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-color-of-various-elements-to-complementary-colors.chinese.md
index eb983b1a34..d47d89adfc 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-color-of-various-elements-to-complementary-colors.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-color-of-various-elements-to-complementary-colors.chinese.md
@@ -23,13 +23,13 @@ localeTitle: 将各种元素的颜色调整为互补色
```yml
tests:
- text: 'header
元素应该有一个值为 #09A7A1
的 background-color
CSS 属性。'
- testString: assert($('header').css('background-color') == 'rgb(9, 167, 161)', 'header
元素应该有一个值为 #09A7A1
的 background-color
CSS 属性。');
+ testString: "assert($('header').css('background-color') == 'rgb(9, 167, 161)');"
- text: 'footer
元素应该有一个值为 #09A7A1
的 background-color
CSS 属性。'
- testString: assert($('footer').css('background-color') == 'rgb(9, 167, 161)', 'footer
元素应该有一个值为 #09A7A1
的 background-color
CSS 属性。');
+ testString: "assert($('footer').css('background-color') == 'rgb(9, 167, 161)');"
- text: 'h2
元素应该有一个值为 #09A7A1
的 color
CSS 属性。'
- testString: assert($('h2').css('color') == 'rgb(9, 167, 161)', 'h2
元素应该有一个值为 #09A7A1
的 color
CSS 属性。');
+ testString: "assert($('h2').css('color') == 'rgb(9, 167, 161)');"
- text: 'button
元素应该有一个值为 #FF790E
的 background-color
CSS 属性。'
- testString: assert($('button').css('background-color') == 'rgb(255, 121, 14)', 'button
元素应该有一个值为 #FF790E
的 background-color
CSS 属性。');
+ testString: "assert($('button').css('background-color') == 'rgb(255, 121, 14)');"
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-height-of-an-element-using-the-height-property.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-height-of-an-element-using-the-height-property.chinese.md
index 5e6983a15c..462a6aae64 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-height-of-an-element-using-the-height-property.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-height-of-an-element-using-the-height-property.chinese.md
@@ -31,7 +31,7 @@ img {
```yml
tests:
- text: '你应该设置 h4
的 height
属性,使其值为 25px
。'
- testString: assert($('h4').css('height') == '25px', '你应该设置 h4
的 height
属性,使其值为 25px
。');
+ testString: assert(Math.round(document.querySelector('h4').getBoundingClientRect().height) === 25 && /h4{\S*height:25px(;\S*}|})/.test($('style').text().replace(/\s/g ,'')));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-hover-state-of-an-anchor-tag.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-hover-state-of-an-anchor-tag.chinese.md
index c331f6ba45..54f0bf5240 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-hover-state-of-an-anchor-tag.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-hover-state-of-an-anchor-tag.chinese.md
@@ -31,9 +31,9 @@ a:hover {
```yml
tests:
- text: '超链接的 color
应该保持黑色,只添加 :hover
CSS 规则。'
- testString: 'assert($(''a'').css(''color'') == ''rgb(0, 0, 0)'', ''超链接的 color
应该保持黑色,只添加 :hover
CSS 规则。'');'
+ testString: assert($('a').css('color') == 'rgb(0, 0, 0)');
- text: '悬停超链接时超链接 color
应该变成蓝色。'
- testString: 'assert(code.match(/a:hover\s*?{\s*?color:\s*?blue;\s*?}/gi), ''悬停超链接时超链接 color
应该变成蓝色。'');'
+ testString: assert(code.match(/a:hover\s*?{\s*?color:\s*?(blue|rgba\(\s*?0\s*?,\s*?0\s*?,\s*?255\s*?,\s*?1\s*?\)|#00F|rgb\(\s*?0\s*?,\s*?0\s*?,\s*?255\s*?\))\s*?;\s*?}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-hue-of-a-color.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-hue-of-a-color.chinese.md
index e6a8992b15..5c24e95ff4 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-hue-of-a-color.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-hue-of-a-color.chinese.md
@@ -28,17 +28,17 @@ HSL 色彩空间模型是一种将 RGB 色彩模型中的点放在圆柱坐标
```yml
tests:
- text: '你应该使用 hsl()
属性来表示绿色。'
- testString: 'assert(code.match(/\.green\s*?{\s*?background-color:\s*?hsl/gi), ''你应该使用 hsl()
属性来表示绿色。'');'
+ testString: assert(code.match(/\.green\s*?{\s*?background-color:\s*?hsl/gi));
- text: '你应该使用 hsl()
属性来表示蓝绿色。'
- testString: 'assert(code.match(/\.cyan\s*?{\s*?background-color:\s*?hsl/gi), ''你应该使用 hsl()
属性来表示蓝绿色。'');'
+ testString: assert(code.match(/\.cyan\s*?{\s*?background-color:\s*?hsl/gi));
- text: '你应该使用 hsl()
属性来表示蓝色。'
- testString: 'assert(code.match(/\.blue\s*?{\s*?background-color:\s*?hsl/gi), ''你应该使用 hsl()
属性来表示蓝色。'');'
+ testString: assert(code.match(/\.blue\s*?{\s*?background-color:\s*?hsl/gi));
- text: 'class 为 green
的 div
应该有绿色的 background-color
CSS 属性。'
- testString: assert($('.green').css('background-color') == 'rgb(0, 255, 0)', 'class 为 green
的 div
应该有绿色的 background-color
CSS 属性。');
+ testString: assert($('.green').css('background-color') == 'rgb(0, 255, 0)');
- text: 'class 为 cyan
的 div
应该有蓝绿色的 background-color
CSS 属性。'
- testString: assert($('.cyan').css('background-color') == 'rgb(0, 255, 255)', 'class 为 cyan
的 div
应该有蓝绿色的 background-color
CSS 属性。');
+ testString: assert($('.cyan').css('background-color') == 'rgb(0, 255, 255)');
- text: 'class 为 blue
的 div
应该有蓝色的 background-color
CSS 属性。'
- testString: assert($('.blue').css('background-color') == 'rgb(0, 0, 255)', 'class 为 cyan
的 div
应该有蓝色的 background-color
CSS 属性。');
+ testString: assert($('.blue').css('background-color') == 'rgb(0, 0, 255)');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-size-of-a-header-versus-a-paragraph-tag.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-size-of-a-header-versus-a-paragraph-tag.chinese.md
index 3f818a12ca..1c8244c747 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-size-of-a-header-versus-a-paragraph-tag.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-size-of-a-header-versus-a-paragraph-tag.chinese.md
@@ -23,7 +23,7 @@ localeTitle: 调整标题与段落的大小
```yml
tests:
- text: '你应该给 h4
元素添加一个 font-size
属性并且赋值 27px
。'
- testString: assert($('h4').css('font-size') == '27px', '你应该给 h4
元素添加一个 font-size
属性并且赋值 27px
。');
+ testString: assert($('h4').css('font-size') == '27px');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-tone-of-a-color.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-tone-of-a-color.chinese.md
index ae4a6a3ee4..36510680c4 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-tone-of-a-color.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-tone-of-a-color.chinese.md
@@ -23,7 +23,7 @@ localeTitle: 调整颜色的色调
```yml
tests:
- text: 'nav
元素应该有一个使用 hsl()
属性调节蓝绿色调的 background-color
CSS 属性。'
- testString: 'assert(code.match(/nav\s*?{\s*?background-color:\s*?hsl\(180,\s*?80%,\s*?25%\)/gi), ''nav
元素应该有一个使用 hsl()
调节蓝绿色调的 background-color
CSS 属性。'');'
+ testString: assert(code.match(/nav\s*?{\s*?background-color:\s*?hsl\(180,\s*?80%,\s*?25%\)/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-width-of-an-element-using-the-width-property.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-width-of-an-element-using-the-width-property.chinese.md
index 3344e23019..f8f5305574 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-width-of-an-element-using-the-width-property.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/adjust-the-width-of-an-element-using-the-width-property.chinese.md
@@ -30,7 +30,7 @@ img {
```yml
tests:
- text: '你应该使用 fullCard
class 选择器将卡片的 width
宽度属性更改为 245px
。'
- testString: 'assert(code.match(/.fullCard\s*{[\s\S][^}]*\n*^\s*width\s*:\s*245px\s*;/gm), ''你应该使用 fullCard
class 选择器将卡片的 width
宽度属性更改为 245px
。'');'
+ testString: const fullCard = code.match(/\.fullCard\s*{[\s\S]+?[^}]}/g); assert(fullCard && /width\s*:\s*245px\s*(;|})/gi.test(fullCard[0]) && $('.fullCard').css('maxWidth') === 'none');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/animate-elements-at-variable-rates.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/animate-elements-at-variable-rates.chinese.md
index 2ef06f92be..74d4865d81 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/animate-elements-at-variable-rates.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/animate-elements-at-variable-rates.chinese.md
@@ -24,7 +24,7 @@ localeTitle: 以可变速率来给元素添加动画
```yml
tests:
- text: 'star-1
class 的 @keyframes
规则应该为50%。'
- testString: assert(code.match(/twinkle-1\s*?{\s*?50%/g), 'star-1
class 的 @keyframes
规则应该为50%。');
+ testString: assert(code.match(/twinkle-1\s*?{\s*?50%/g));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/animate-elements-continually-using-an-infinite-animation-count.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/animate-elements-continually-using-an-infinite-animation-count.chinese.md
index 95a89f4db1..5e5a51e7c9 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/animate-elements-continually-using-an-infinite-animation-count.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/animate-elements-continually-using-an-infinite-animation-count.chinese.md
@@ -25,7 +25,7 @@ localeTitle: 使用无限的动画计数制作永不停止的动画
```yml
tests:
- text: 'animation-iteration-count
属性值应该为 infinite。'
- testString: assert($('#ball').css('animation-iteration-count') == 'infinite', 'animation-iteration-count
属性值应该为 infinite。');
+ testString: assert($('#ball').css('animation-iteration-count') == 'infinite');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/animate-multiple-elements-at-variable-rates.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/animate-multiple-elements-at-variable-rates.chinese.md
index 4f03a3ff99..5583832e0d 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/animate-multiple-elements-at-variable-rates.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/animate-multiple-elements-at-variable-rates.chinese.md
@@ -24,11 +24,11 @@ localeTitle: 以可变速率来给多个元素添加动画
```yml
tests:
- text: 'class 为 star-1
的 animation-duration
属性值应该 1s。'
- testString: assert($('.star-1').css('animation-duration') == '1s', 'class 为 star-1
的 animation-duration
属性值应该 1s。');
+ testString: assert($('.star-1').css('animation-duration') == '1s');
- text: 'class 为 star-2
的 animation-duration
属性值应该 0.9s。'
- testString: assert($('.star-2').css('animation-duration') == '0.9s', 'class 为 star-2
的 animation-duration
属性值应该 0.9s。');
+ testString: assert($('.star-2').css('animation-duration') == '0.9s');
- text: 'class 为 star-3
的 animation-duration
属性值应该 1.1s。'
- testString: assert($('.star-3').css('animation-duration') == '1.1s', 'class 为 star-3
的 animation-duration
属性值应该 1.1s。');
+ testString: assert($('.star-3').css('animation-duration') == '1.1s');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/center-an-element-horizontally-using-the-margin-property.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/center-an-element-horizontally-using-the-margin-property.chinese.md
index 921f4dfff3..24676c8ca9 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/center-an-element-horizontally-using-the-margin-property.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/center-an-element-horizontally-using-the-margin-property.chinese.md
@@ -24,7 +24,7 @@ localeTitle: 使用 margin 属性将元素水平居中
```yml
tests:
- text: 'div
的 margin
应该为 auto
。'
- testString: 'assert(code.match(/margin:\s*?auto;/g), ''div
的 margin
应该为 auto
。'');'
+ testString: assert(code.match(/margin:\s*?auto;/g));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/change-an-elements-relative-position.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/change-an-elements-relative-position.chinese.md
index f3739a9609..45b6d1c72c 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/change-an-elements-relative-position.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/change-an-elements-relative-position.chinese.md
@@ -34,9 +34,9 @@ p {
```yml
tests:
- text: 'h2
元素应该添加 position
属性并赋值 relative
。'
- testString: assert($('h2').css('position') == 'relative', 'h2
元素应该添加position
属性并赋值 relative
。');
+ testString: assert($('h2').css('position') == 'relative');
- text: '你应该使用 CSS 属性调整 h2
的位置使其从原来的位置向下偏移 15px
。'
- testString: assert($('h2').css('top') == '15px', '你应该使用 CSS 属性调整 h2
的位置使其从原来的位置向下偏移 15px
。');
+ testString: assert($('h2').css('top') == '15px');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/change-animation-timing-with-keywords.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/change-animation-timing-with-keywords.chinese.md
index d576a5aa2c..c8a637b781 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/change-animation-timing-with-keywords.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/change-animation-timing-with-keywords.chinese.md
@@ -24,9 +24,9 @@ localeTitle: 使用关键字更改动画定时器
```yml
tests:
- text: 'id 为 ball1
的元素的 animation-timing-function
属性值应该为 linear。'
- testString: assert($('#ball1').css('animation-timing-function') == 'linear', 'id 为 ball1
的元素的 animation-timing-function
属性值应该为 linear。');
+ testString: const ball1Animation = $('#ball1').css('animation-timing-function').replace(/\s/g, '');assert(ball1Animation == 'linear' || ball1Animation == 'cubic-bezier(0,0,1,1)');
- text: 'id 为 ball2
的元素的 animation-timing-function
属性值应该为 ease-out。'
- testString: assert($('#ball2').css('animation-timing-function') == 'ease-out', 'id 为 ball2
的元素的 animation-timing-function
属性值应该为 ease-out。');
+ testString: const ball2Animation = $('#ball2').css('animation-timing-function').replace(/\s/g, ''); assert(ball2Animation == 'ease-out' || ball2Animation == 'cubic-bezier(0,0,0.58,1)');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/change-the-position-of-overlapping-elements-with-the-z-index-property.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/change-the-position-of-overlapping-elements-with-the-z-index-property.chinese.md
index 70d15cf255..53904b5af3 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/change-the-position-of-overlapping-elements-with-the-z-index-property.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/change-the-position-of-overlapping-elements-with-the-z-index-property.chinese.md
@@ -23,7 +23,7 @@ localeTitle: 使用 z-index 属性更改重叠元素的位置
```yml
tests:
- text: 'class 为 first
的元素的 z-index
值应该为 2。'
- testString: assert($('.first').css('z-index') == '2', 'class 为 first
的元素的 z-index
值应该为 2。');
+ testString: assert($('.first').css('z-index') == '2');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-a-gradual-css-linear-gradient.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-a-gradual-css-linear-gradient.chinese.md
index 8095848cd5..6f506e5585 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-a-gradual-css-linear-gradient.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-a-gradual-css-linear-gradient.chinese.md
@@ -28,7 +28,7 @@ HTML 元素的背景色并不局限于单色。CSS 还提供了颜色过渡,
```yml
tests:
- text: 'div
元素应该有一个指定方向和颜色的 linear-gradient
background
渐变色。'
- testString: 'assert(code.match(/background:\s*?linear-gradient\(35deg,\s*?(#CCFFFF|#CFF),\s*?(#FFCCCC|#FCC)\);/gi), ''div
元素应该有一个指定方向和颜色的 linear-gradient
background
渐变色。'');'
+ testString: assert($('div').css('background-image').match(/linear-gradient\(35deg, rgb\(204, 255, 255\), rgb\(255, 204, 204\)\)/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-a-graphic-using-css.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-a-graphic-using-css.chinese.md
index fd3ced5dff..531fb3dd3e 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-a-graphic-using-css.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-a-graphic-using-css.chinese.md
@@ -27,11 +27,11 @@ localeTitle: 使用 CSS 创建一个图形
```yml
tests:
- text: 'background-color
属性应该取值 transparent
。'
- testString: 'assert(code.match(/background-color:\s*?transparent;/gi), ''background-color
属性应该取值 transparent
。'');'
+ testString: assert(code.match(/background-color:\s*?transparent;/gi));
- text: 'border-radius
属性应该取值 50%
。'
- testString: 'assert(code.match(/border-radius:\s*?50%;/gi), ''border-radius
属性应该取值50%
。'');'
+ testString: assert(code.match(/border-radius:\s*?50%;/gi));
- text: 'box-shadow
属性的 offset-x
、offset-y
、blur-radius
、spread-radius
和 color
应该依次取值25px
、10px
、0
、0
和 blue
。'
- testString: 'assert(code.match(/box-shadow:\s*?25px\s+?10px\s+?0(px)?\s+?0(px)?\s+?blue\s*?;/gi), ''box-shadow
属性的 offset-x
、offset-y
、blur-radius
、spread-radius
和 color
应该依次取值25px
、10px
、0
、0
和 blue
。'');'
+ testString: assert(code.match(/box-shadow:\s*?25px\s+?10px\s+?0(px)?\s+?0(px)?\s+?blue\s*?;/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-a-horizontal-line-using-the-hr-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-a-horizontal-line-using-the-hr-element.chinese.md
index a4b7049151..484d95b5bb 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-a-horizontal-line-using-the-hr-element.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-a-horizontal-line-using-the-hr-element.chinese.md
@@ -25,9 +25,9 @@ localeTitle: 使用 hr 标签创建水平线
```yml
tests:
- text: '你应该添加一个 hr
标签。'
- testString: assert($('hr').length == 1, '你应该添加一个 hr
标签。');
+ testString: assert($('hr').length == 1);
- text: 'hr
标签应该在标题和段落之间。'
- testString: assert(code.match(/<\/h4>\s*?
/gi), 'hr
标签应该在标题和段落之间。');
+ testString: assert(code.match(/<\/h4>\s*?
/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-a-more-complex-shape-using-css-and-html.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-a-more-complex-shape-using-css-and-html.chinese.md
index 62e02fb7be..b9e59982d3 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-a-more-complex-shape-using-css-and-html.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-a-more-complex-shape-using-css-and-html.chinese.md
@@ -41,13 +41,13 @@ localeTitle: 使用 CSS 和 HTML 创建更复杂的形状
```yml
tests:
- text: ' "));
+ testString: assert((code.match(/<([a-z0-9]){1,2}>/g)[0]===" ") );
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/create-a-set-of-checkboxes.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/create-a-set-of-checkboxes.chinese.md
index c9070bc739..8898584be1 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/create-a-set-of-checkboxes.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/create-a-set-of-checkboxes.chinese.md
@@ -31,11 +31,11 @@ tests:
- text: '表单应该有三个复选框。'
testString: assert($('input[type="checkbox"]').length > 2);
- text: '每个复选框都应该被嵌套进 (.*\s*)*?<\/p>\s*?))|(( \s*?.*?\s*?<\/p>\s*?)( [\w\W]*<\/p>/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/headline-with-the-h2-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/headline-with-the-h2-element.chinese.md
index 7bf765a663..68302addcb 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/headline-with-the-h2-element.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/headline-with-the-h2-element.chinese.md
@@ -29,7 +29,7 @@ tests:
- text: ' main .*?<\/p>";/g), "Your code should keep the double quotes around the entire string.");'
+ testString: assert(code.match(/" .*?<\/p>";/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.chinese.md
index 25ba88e31a..149e01a828 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 使用索引时捕获一个错误
```yml
tests:
- text: 您的代码应该设置循环的初始条件,以便从第一个索引开始。
- testString: 'assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1, "Your code should set the initial condition of the loop so it starts at the first index.");'
+ testString: assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1);
- text: 您的代码应该修复循环的初始条件,以便索引从0开始。
- testString: 'assert(!code.match(/i\s?=\s*?1\s*?;/g), "Your code should fix the initial condition of the loop so that the index starts at 0.");'
+ testString: assert(!code.match(/i\s?=\s*?1\s*?;/g));
- text: 您的代码应设置循环的终端条件,以便它停在最后一个索引处。
- testString: 'assert(code.match(/i\s*?<\s*?len\s*?;/g).length == 1, "Your code should set the terminal condition of the loop so it stops at the last index.");'
+ testString: assert(code.match(/i\s*?<\s*?len\s*?;/g).length == 1);
- text: 您的代码应该修复循环的终端条件,使其在长度之前停止在1。
- testString: 'assert(!code.match(/i\s*?<=\s*?len;/g), "Your code should fix the terminal condition of the loop so that it stops at 1 before the length.");'
+ testString: assert(!code.match(/i\s*?<=\s*?len;/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.chinese.md
index c0e7c8c948..971d27d2c4 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 抓住未封闭的圆括号,括号,括号和引号
```yml
tests:
- text: 您的代码应该修复数组中缺少的部分。
- testString: 'assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g), "Your code should fix the missing piece of the array.");'
+ testString: assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g));
- text: 您的代码应该修复heart::after
选择器的 background-color
属性值应该为粉色。'
- testString: 'assert(code.match(/\.heart::after\s*?{\s*?background-color\s*?:\s*?pink\s*?;/gi), ''heart::after
选择器的 background-color
属性值应该为粉色。'');'
+ testString: assert(code.match(/\.heart::after\s*?{\s*?background-color\s*?:\s*?pink\s*?;/gi));
- text: 'heart::after
选择器的 border-radius
属性值应该为 50%。'
- testString: 'assert(code.match(/border-radius\s*?:\s*?50%/gi).length == 2, ''heart::after
选择器的 border-radius
属性值应该为 50%。'');'
+ testString: assert(code.match(/border-radius\s*?:\s*?50%/gi).length == 2);
- text: 'heart
class 的 transform
属性应该使用 rotate()
函数并赋参为 -45deg
。'
- testString: 'assert(code.match(/transform\s*?:\s*?rotate\(\s*?-45deg\s*?\)/gi), ''heart
class 的 transform
属性应该使用 rotate()
函数并赋参为 -45deg
。'');'
+ testString: assert(code.match(/transform\s*?:\s*?rotate\(\s*?-45deg\s*?\)/gi));
- text: 'heart::before
选择器的content
应该为空字符串。'
- testString: 'assert(code.match(/\.heart::before\s*?{\s*?content\s*?:\s*?("|'')\1\s*?;/gi), ''heart::before
选择器的 content
应该为空字符串。'');'
+ testString: assert(code.match(/\.heart::before\s*?{\s*?content\s*?:\s*?("|')\1\s*?;/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-movement-using-css-animation.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-movement-using-css-animation.chinese.md
index 29b39f36ca..9762560bb4 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-movement-using-css-animation.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-movement-using-css-animation.chinese.md
@@ -42,11 +42,11 @@ localeTitle: 使用 CSS 动画创建运动
```yml
tests:
- text: '0%
的 @keyframes
规则应该为向 left
偏移 0px
。'
- testString: 'assert(code.match(/0%\s*?{\s*?background-color:\s*?blue;\s*?top:\s*?0px;\s*?left:\s*?0px;\s*?}/gi), ''0%
的 @keyframes
规则应该为向 left
偏移 0px
。'');'
+ testString: assert(code.match(/0%\s*?{\s*?background-color:\s*?blue;\s*?top:\s*?0(px)?;\s*?left:\s*?0(px)?;\s*?}/gi));
- text: '50%
的 @keyframes
规则应该为向 left
偏移25px
。'
- testString: 'assert(code.match(/50%\s*?{\s*?background-color:\s*?green;\s*?top:\s*?50px;\s*?left:\s*?25px;\s*?}/gi), ''50%
的 @keyframes
规则应该为向left
偏移 25px
。'');'
+ testString: assert(code.match(/50%\s*?{\s*?background-color:\s*?green;\s*?top:\s*?50px;\s*?left:\s*?25px;\s*?}/gi));
- text: '100%
的 @keyframes
规则应该为向 left
偏移-25px
。'
- testString: 'assert(code.match(/100%\s*?{\s*?background-color:\s*?yellow;\s*?top:\s*?0px;\s*?left:\s*?-25px;\s*?}/gi), ''100%
的 @keyframes
规则应该为向left
偏移 -25px
。'');'
+ testString: assert(code.match(/100%\s*?{\s*?background-color:\s*?yellow;\s*?top:\s*?0(px)?;\s*?left:\s*?-25px;\s*?}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-texture-by-adding-a-subtle-pattern-as-a-background-image.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-texture-by-adding-a-subtle-pattern-as-a-background-image.chinese.md
index 332d7ada32..9d04114de0 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-texture-by-adding-a-subtle-pattern-as-a-background-image.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-texture-by-adding-a-subtle-pattern-as-a-background-image.chinese.md
@@ -23,7 +23,7 @@ localeTitle: 通过添加细微图案作为背景图像来创建纹理
```yml
tests:
- text: 'body
元素选择器应包含 background
属性,且值为给定的 url
。'
- testString: 'assert(code.match(/background:\s*?url\(\s*("|''|)https:\/\/i\.imgur\.com\/MJAkxbh\.png\1\s*\)/gi), ''body
元素选择器应包含 background
属性,且值为给定的 url
。'');'
+ testString: assert(code.match(/background:\s*?url\(\s*("|'|)https:\/\/cdn-media-1\.freecodecamp\.org\/imgr\/MJAkxbh\.png\1\s*\)/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-visual-balance-using-the-text-align-property.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-visual-balance-using-the-text-align-property.chinese.md
index 031cb35edf..9cbe0ab1b2 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-visual-balance-using-the-text-align-property.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-visual-balance-using-the-text-align-property.chinese.md
@@ -28,9 +28,9 @@ web 内容大部分都是文本。CSS 里面的 text-align
属性
```yml
tests:
- text: '你应该在 h4
标签上使用 text-align 属性设置文本居中对齐。'
- testString: assert($('h4').css('text-align') == 'center', '你应该在 h4
标签上使用 text-align 属性设置文本居中对齐。');
+ testString: assert($('h4').css('text-align') == 'center');
- text: '你应该在 p
标签上使用 text-align 属性设置文本两端对齐。'
- testString: assert($('p').css('text-align') == 'justify', '你应该在 p
标签上使用 text-align 属性设置文本两端对齐。');
+ testString: assert($('p').css('text-align') == 'justify');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-visual-direction-by-fading-an-element-from-left-to-right.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-visual-direction-by-fading-an-element-from-left-to-right.chinese.md
index 1e514c071b..ce705b686b 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-visual-direction-by-fading-an-element-from-left-to-right.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/create-visual-direction-by-fading-an-element-from-left-to-right.chinese.md
@@ -24,7 +24,7 @@ localeTitle: 通过从左到右淡化元素来创建视觉方向
```yml
tests:
- text: '50% 处 keyframes
规则应该设置 opacity
属性值为 0.1 以使其渐隐。'
- testString: 'assert(code.match(/@keyframes fade\s*?{\s*?50%\s*?{\s*?(?:left:\s*?60%;\s*?opacity:\s*?0?\.1;|opacity:\s*?0?\.1;\s*?left:\s*?60%;)/gi), ''50% 处 keyframes
规则应该设置 opacity
属性值为 0.1 以使其渐隐。'');'
+ testString: assert(code.match(/@keyframes fade\s*?{\s*?50%\s*?{\s*?(?:left:\s*?60%;\s*?opacity:\s*?0?\.1;|opacity:\s*?0?\.1;\s*?left:\s*?60%;)/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/decrease-the-opacity-of-an-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/decrease-the-opacity-of-an-element.chinese.md
index 3b315643be..0b9b23f432 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/decrease-the-opacity-of-an-element.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/decrease-the-opacity-of-an-element.chinese.md
@@ -25,7 +25,7 @@ CSS 里的 opacity
属性用来设置元素的透明度。
```yml
tests:
- text: '你应该使用 links
class 选择所有的超链接并设置其 opacity
值为 0.7。'
- testString: assert.approximately(parseFloat($('.links').css('opacity')), 0.7, 0.1, '你应该使用 links
class 选择所有的超链接并设置其 opacity
值为 0.7。');
+ testString: assert(/\.links\s*{([\s\S]*?;)*\s*opacity\s*:\s*0*\.70*\s*(;[\s\S]*?|\s*)}/.test($('style').text()));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/learn-about-complementary-colors.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/learn-about-complementary-colors.chinese.md
index a87594f491..cda572ac03 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/learn-about-complementary-colors.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/learn-about-complementary-colors.chinese.md
@@ -28,9 +28,9 @@ localeTitle: 了解互补色
```yml
tests:
- text: 'class 为 blue
的 div
元素应该有值为蓝色的 background-color
CSS 属性。'
- testString: assert($('.blue').css('background-color') == 'rgb(0, 0, 255)', 'class 为 blue
的 div
元素应该有值为蓝色的 background-color
CSS 属性。');
+ testString: assert($('.blue').css('background-color') == 'rgb(0, 0, 255)');
- text: 'class 为 yellow
的 div
元素应该有值为黄色的 background-color
CSS 属性。'
- testString: assert($('.yellow').css('background-color') == 'rgb(255, 255, 0)', 'class 为 yellow
的 div
元素应该有值为黄色的 background-color
CSS 属性。');
+ testString: assert($('.yellow').css('background-color') == 'rgb(255, 255, 0)');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/learn-about-tertiary-colors.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/learn-about-tertiary-colors.chinese.md
index fae726fcf3..46461de4c8 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/learn-about-tertiary-colors.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/learn-about-tertiary-colors.chinese.md
@@ -27,11 +27,11 @@ localeTitle: 了解三原色
```yml
tests:
- text: 'class 为 orange
的 div
应该有值为橙色的 background-color
CSS 属性。'
- testString: assert($('.orange').css('background-color') == 'rgb(255, 125, 0)', 'class 为 orange
的 div
应该有值为橙色的 background-color
CSS 属性。');
+ testString: assert($('.orange').css('background-color') == 'rgb(255, 127, 0)');
- text: 'class 为 cyan
的 div
应该有值为蓝绿色的 background-color
CSS 属性。'
- testString: assert($('.cyan').css('background-color') == 'rgb(0, 255, 255)', 'class 为 cyan
的 div
应该有值为蓝绿色的 background-color
CSS 属性。');
+ testString: assert($('.cyan').css('background-color') == 'rgb(0, 255, 255)');
- text: 'class 为 raspberry
的 div
应该有值为树莓红色的 background-color
CSS 属性。'
- testString: assert($('.raspberry').css('background-color') == 'rgb(255, 0, 125)', 'class 为 raspberry
的 div
应该有值为树莓红色的 background-color
CSS 属性。');
+ testString: assert($('.raspberry').css('background-color') == 'rgb(255, 0, 127)');
- text: 'corlor classes 里的所有的 background-color
应该是 HEX 颜色码而不是颜色名称。'
testString: assert(!/background-color:\s(orange|cyan|raspberry)/.test(code));
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/learn-how-bezier-curves-work.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/learn-how-bezier-curves-work.chinese.md
index 4f9fd80cf0..dfe9545e89 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/learn-how-bezier-curves-work.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/learn-how-bezier-curves-work.chinese.md
@@ -27,9 +27,9 @@ localeTitle: 学习贝塞尔曲线的原理
```yml
tests:
- text: 'id 为 ball1
的元素的 animation-timing-function
属性值应该为和 linear 预定值等价的贝塞尔函数值。'
- testString: assert($('#ball1').css('animation-timing-function') == 'cubic-bezier(0.25, 0.25, 0.75, 0.75)', 'id 为 ball1
的元素的 animation-timing-function
属性应该为和 linear 预定值等价的贝塞尔函数值。');
+ testString: assert($('#ball1').css('animation-timing-function') == 'cubic-bezier(0.25, 0.25, 0.75, 0.75)');
- text: 'id 为 ball2
元素的 animation-timing-function
属性值应该保持不变。'
- testString: assert($('#ball2').css('animation-timing-function') == 'ease-out', 'id 为 ball2
元素的 animation-timing-function
属性值应该保持不变。');
+ testString: const ball2Animation = $('#ball2').css('animation-timing-function').replace(/\s/g, ''); assert(ball2Animation == 'ease-out' || ball2Animation == 'cubic-bezier(0,0,0.58,1)');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/learn-how-the-css-keyframes-and-animation-properties-work.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/learn-how-the-css-keyframes-and-animation-properties-work.chinese.md
index 1352bf52a4..b84013b83e 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/learn-how-the-css-keyframes-and-animation-properties-work.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/learn-how-the-css-keyframes-and-animation-properties-work.chinese.md
@@ -45,17 +45,17 @@ id 为 anim
的元素,代码设置 animation-name
```yml
tests:
- text: 'id 为 rect
的元素应该有一个值为 rainbow 的 animation-name
属性。'
- testString: assert($('#rect').css('animation-name') == 'rainbow', 'id 为 rect
的元素应该有一个值为 rainbow 的 animation-name
属性。');
+ testString: assert($('#rect').css('animation-name') == 'rainbow');
- text: 'id 为 rect
的元素应该有一个值为 4s 的 animation-duration
属性。'
- testString: assert($('#rect').css('animation-duration') == '4s', 'id 为 rect
的元素应该有一个值为 4s 的 animation-duration
属性。');
+ testString: assert($('#rect').css('animation-duration') == '4s');
- text: '@keyframes
规则的 animation-name
应该为 rainbow。'
- testString: assert(code.match(/@keyframes\s+?rainbow\s*?{/g), '@keyframes
规则的 animation-name
应该为 rainbow。');
+ testString: assert(code.match(/@keyframes\s+?rainbow\s*?{/g));
- text: '@keyframes
规则的 rainbow 在 0% 时的 background-color
应该为蓝色。'
- testString: 'assert(code.match(/0%\s*?{\s*?background-color:\s*?blue;\s*?}/gi), ''@keyframes
规则的 rainbow 在 0% 时的 background-color
应该为蓝色。'');'
+ testString: assert(code.match(/0%\s*?{\s*?background-color:\s*?blue;\s*?}/gi));
- text: '@keyframes
规则的 rainbow 在 50% 时的 background-color
应该为绿色。'
- testString: 'assert(code.match(/50%\s*?{\s*?background-color:\s*?green;\s*?}/gi), ''@keyframes
规则的 rainbow 在 50% 时的 background-color
应该为绿色。'');'
+ testString: assert(code.match(/50%\s*?{\s*?background-color:\s*?green;\s*?}/gi));
- text: '@keyframes
规则的 rainbow 在 100% 时的 background-color
应该为黄色。'
- testString: 'assert(code.match(/100%\s*?{\s*?background-color:\s*?yellow;\s*?}/gi), ''@keyframes
规则的 rainbow 在 100% 时的 background-color
应该为黄色。'');'
+ testString: assert(code.match(/100%\s*?{\s*?background-color:\s*?yellow;\s*?}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/lock-an-element-to-its-parent-with-absolute-positioning.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/lock-an-element-to-its-parent-with-absolute-positioning.chinese.md
index ce8da7fad3..ff6d0f57be 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/lock-an-element-to-its-parent-with-absolute-positioning.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/lock-an-element-to-its-parent-with-absolute-positioning.chinese.md
@@ -24,11 +24,11 @@ localeTitle: 绝对定位的参照物是元素的父元素
```yml
tests:
- text: '#searchbar
元素应当有一个值为 absolute
的 position
CSS 属性。'
- testString: assert($('#searchbar').css('position') == 'absolute', '#searchbar
元素应当有一个值为 absolute
的 position
CSS 属性。');
+ testString: assert($('#searchbar').css('position') == 'absolute');
- text: '你的 #searchbar
元素应当有值为 50px
的 top
CSS 属性。'
- testString: assert($('#searchbar').css('top') == '50px', '你的 #searchbar
元素应当有值为 50px
的 top
CSS 属性。');
+ testString: assert($('#searchbar').css('top') == '50px');
- text: '你的 #searchbar
元素应当有值为 50px
的 right
CSS 属性。'
- testString: assert($('#searchbar').css('right') == '50px', '你的 #searchbar
元素应当有值为 50px
的 right
CSS 属性。');
+ testString: assert($('#searchbar').css('right') == '50px');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/lock-an-element-to-the-browser-window-with-fixed-positioning.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/lock-an-element-to-the-browser-window-with-fixed-positioning.chinese.md
index a8a2a5bb8d..3f885ea551 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/lock-an-element-to-the-browser-window-with-fixed-positioning.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/lock-an-element-to-the-browser-window-with-fixed-positioning.chinese.md
@@ -24,11 +24,11 @@ localeTitle: 固定定位的参照物是浏览器的窗口
```yml
tests:
- text: '>#navbar
元素应当有一个值为 fixed
的 position
CSS 属性'
- testString: assert($('#navbar').css('position') == 'fixed', '#navbar
元素应当有一个值为 fixed
的 position
CSS 属性');
+ testString: assert($('#navbar').css('position') == 'fixed');
- text: '你的 #navbar
元素应当有值为 0px
的 top
CSS 属性。'
- testString: assert($('#navbar').css('top') == '0px', '你的 #navbar
元素应当有值为 0px
的 top
CSS 属性。');
+ testString: assert($('#navbar').css('top') == '0px');
- text: '你的 #navbar
元素应当有值为 0px
的 left
CSS 属性。'
- testString: assert($('#navbar').css('left') == '0px', '你的 #navbar
元素应当有值为 0px
的 left
CSS 属性。');
+ testString: assert($('#navbar').css('left') == '0px');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/make-a-css-heartbeat-using-an-infinite-animation-count.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/make-a-css-heartbeat-using-an-infinite-animation-count.chinese.md
index 57b5716654..6c44516c08 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/make-a-css-heartbeat-using-an-infinite-animation-count.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/make-a-css-heartbeat-using-an-infinite-animation-count.chinese.md
@@ -24,9 +24,9 @@ localeTitle: 使用无限的动画计数制作 CSS 心跳
```yml
tests:
- text: 'heart
class 的 animation-iteration-count
属性应该赋值 infinte。'
- testString: assert($('.heart').css('animation-iteration-count') == 'infinite', 'heart
class 的 animation-iteration-count
属性应该赋值 infinite。');
+ testString: assert($('.heart').css('animation-iteration-count') == 'infinite');
- text: 'back
class 的 animation-iteration-count
属性应该赋值 infinite。'
- testString: assert($('.back').css('animation-iteration-count') == 'infinite', 'back
class 的 animation-iteration-count
属性应该赋值 infinite。');
+ testString: assert($('.back').css('animation-iteration-count') == 'infinite');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/make-motion-more-natural-using-a-bezier-curve.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/make-motion-more-natural-using-a-bezier-curve.chinese.md
index 65c240272d..9704869af8 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/make-motion-more-natural-using-a-bezier-curve.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/make-motion-more-natural-using-a-bezier-curve.chinese.md
@@ -27,7 +27,7 @@ localeTitle: 使用贝塞尔曲线让运动更加自然
```yml
tests:
- text: 'id 为green
的元素的animation-timing-function
值应该为cubic-bezier
函数,函数的参数 x1,y1,x2,y2 值依次为 0.311、0.441、0.444、1.649。'
- testString: assert($('#green').css('animation-timing-function') == 'cubic-bezier(0.311, 0.441, 0.444, 1.649)', 'id 为green
的元素的animation-timing-function
值应该为cubic-bezier
函数,函数的参数 x1,y1,x2,y2 值依次为 0.311、0.441、0.444、1.649。');
+ testString: assert($('#green').css('animation-timing-function') == 'cubic-bezier(0.311, 0.441, 0.444, 1.649)');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/modify-fill-mode-of-an-animation.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/modify-fill-mode-of-an-animation.chinese.md
index e9be35badf..8b0e887ca7 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/modify-fill-mode-of-an-animation.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/modify-fill-mode-of-an-animation.chinese.md
@@ -25,7 +25,7 @@ localeTitle: 修改动画的填充模式
```yml
tests:
- text: 'button:hover
应该有一个值为 forwards
的 animation-fill-mode
的属性。'
- testString: 'assert(code.match(/button\s*?:\s*?hover\s*?{[\s\S]*animation-fill-mode\s*?:\s*?forwards\s*?;[\s\S]*}/gi) && code.match(/button\s*?:\s*?hover\s*?{[\s\S]*animation-name\s*?:\s*?background-color\s*?;[\s\S]*}/gi) && code.match(/button\s*?:\s*?hover\s*?{[\s\S]*animation-duration\s*?:\s*?500ms\s*?;[\s\S]*}/gi), ''button:hover
应该有一个值为 forwards
的 animation-fill-mode
的属性。'');'
+ testString: assert(code.match(/button\s*?:\s*?hover\s*?{[\s\S]*animation-fill-mode\s*?:\s*?forwards\s*?;[\s\S]*}/gi) && code.match(/button\s*?:\s*?hover\s*?{[\s\S]*animation-name\s*?:\s*?background-color\s*?;[\s\S]*}/gi) && code.match(/button\s*?:\s*?hover\s*?{[\s\S]*animation-duration\s*?:\s*?500ms\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/move-a-relatively-positioned-element-with-css-offsets.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/move-a-relatively-positioned-element-with-css-offsets.chinese.md
index b4562d0adf..cf077c079d 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/move-a-relatively-positioned-element-with-css-offsets.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/move-a-relatively-positioned-element-with-css-offsets.chinese.md
@@ -24,9 +24,9 @@ CSS 里面的 top
、bottom
、left
和 10px
。也就是说,从 h2
当前位置远离 bottom
10px
。'
- testString: assert($('h2').css('bottom') == '10px', '你应该使用 CSS 属性使 h2
相对当前位置向上移动 10px
。也就是说,从 h2
当前位置远离 bottom
10px
。');
+ testString: assert($('h2').css('bottom') == '10px');
- text: '你应该使用 CSS 属性使 h2
相对当前位置向右移动 15px
。也就是说,从 h2
当前位置远离 left
15px
。'
- testString: assert($('h2').css('left') == '15px', '你应该使用 CSS 属性使 h2
相对当前位置向右移动 15px
。也就是说,从 h2
当前位置远离left
15px
。');
+ testString: assert($('h2').css('left') == '15px');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/push-elements-left-or-right-with-the-float-property.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/push-elements-left-or-right-with-the-float-property.chinese.md
index f5463fc6b2..ebdcdc2140 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/push-elements-left-or-right-with-the-float-property.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/push-elements-left-or-right-with-the-float-property.chinese.md
@@ -23,9 +23,9 @@ localeTitle: 使用 float 属性将元素左浮动或右浮动
```yml
tests:
- text: 'id 为 left
的元素应该有一个值为 left
的 float
CSS 属性。'
- testString: assert($('#left').css('float') == 'left', 'id 为 left
的元素应该有一个值为 left
的 float
CSS 属性。');
+ testString: assert($('#left').css('float') == 'left');
- text: 'id 为 right
的元素应该有一个值为 right
的 float
CSS 属性。'
- testString: assert($('#right').css('float') == 'right', 'id 为 right
的元素应该有一个值为 right
的 float
CSS 属性。');
+ testString: assert($('#right').css('float') == 'right');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/set-the-font-size-for-multiple-heading-elements.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/set-the-font-size-for-multiple-heading-elements.chinese.md
index c989ebe735..99ea9dfb5b 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/set-the-font-size-for-multiple-heading-elements.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/set-the-font-size-for-multiple-heading-elements.chinese.md
@@ -23,17 +23,17 @@ localeTitle: 设置多个标题元素的 font-size
```yml
tests:
- text: '你应该设置 h1
标签的 font-size
为 68px
。'
- testString: assert($('h1').css('font-size') == '68px', '你应该设置 h1
标签的 font-size
为 68px
。');
+ testString: assert($('h1').css('font-size') == '68px');
- text: '你应该设置 h2
标签的 font-size
为 52px
。'
- testString: assert($('h2').css('font-size') == '52px', '你应该设置h2
标签的font-size
为 52px
。');
+ testString: assert($('h2').css('font-size') == '52px');
- text: '你应该设置 h3
标签的 font-size
为 40px
。'
- testString: assert($('h3').css('font-size') == '40px', '你应该设置 h3
标签的 font-size
为 40px
。');
+ testString: assert($('h3').css('font-size') == '40px');
- text: '你应该设置 h4
标签的 font-size
为 32px
。'
- testString: assert($('h4').css('font-size') == '32px', '你应该设置 h4
标签的 font-size
为 32px
。');
+ testString: assert($('h4').css('font-size') == '32px');
- text: '你应该设置 h5
标签的 font-size
为 21px
。'
- testString: assert($('h5').css('font-size') == '21px', '你应该设置 h6
标签的 font-size
为 21px
。');
+ testString: assert($('h5').css('font-size') == '21px');
- text: '你应该设置 h6
标签的 font-size
为 14px
。'
- testString: assert($('h6').css('font-size') == '14px', '你应该设置 h6
标签的 font-size
为 14px
。');
+ testString: assert($('h6').css('font-size') == '14px');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/set-the-font-size-of-paragraph-text.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/set-the-font-size-of-paragraph-text.chinese.md
index 406be9f37b..53e6a780e4 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/set-the-font-size-of-paragraph-text.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/set-the-font-size-of-paragraph-text.chinese.md
@@ -23,7 +23,7 @@ CSS 里面的 font-size
属性不只限于标题,它可以应用
```yml
tests:
- text: '你的 p
标签应该包含一个 font-size
属性并且值为 16px
。'
- testString: assert($('p').css('font-size') == '16px', '你的 p
标签应该包含一个 font-size
属性并且值为 16px
。');
+ testString: assert($('p').css('font-size') == '16px');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/set-the-font-weight-for-multiple-heading-elements.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/set-the-font-weight-for-multiple-heading-elements.chinese.md
index 6403cd7898..09e83b2d73 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/set-the-font-weight-for-multiple-heading-elements.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/set-the-font-weight-for-multiple-heading-elements.chinese.md
@@ -24,17 +24,17 @@ localeTitle: 设置多个标题元素的 font-weight
```yml
tests:
- text: '你应该设置 h1
标签的 font-weight
为 800。'
- testString: assert($('h1').css('font-weight') == '800', '你应该设置 h1
标签的 font-weight
为 800。');
+ testString: assert($('h1').css('font-weight') == '800');
- text: '你应该设置 h2
标签的 font-weight
为 600。'
- testString: assert($('h2').css('font-weight') == '600', '你应该设置 h2
标签的 font-weight
为 600。');
+ testString: assert($('h2').css('font-weight') == '600');
- text: '你应该设置 h3
标签的 font-weight
为 500。'
- testString: assert($('h3').css('font-weight') == '500', '你应该设置 h3
标签的 font-weight
为 500。');
+ testString: assert($('h3').css('font-weight') == '500');
- text: '你应该设置 h4
标签的 font-weight
为 400。'
- testString: assert($('h4').css('font-weight') == '400', '你应该设置 h4
标签的 font-weight
为 400。');
+ testString: assert($('h4').css('font-weight') == '400');
- text: '你应该设置 h5
标签的 font-weight
为 300。'
- testString: assert($('h5').css('font-weight') == '300', '你应该设置 h5
标签的 font-weight
为 300。');
+ testString: assert($('h5').css('font-weight') == '300');
- text: '你应该设置 h6
标签的 font-weight
为 200。'
- testString: assert($('h6').css('font-weight') == '200', '你应该设置 h6
标签的 font-weight
为 200。');
+ testString: assert($('h6').css('font-weight') == '200');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/set-the-line-height-of-paragraphs.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/set-the-line-height-of-paragraphs.chinese.md
index 69f90e84cf..2e527c25aa 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/set-the-line-height-of-paragraphs.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/set-the-line-height-of-paragraphs.chinese.md
@@ -23,7 +23,7 @@ CSS 提供 line-height
属性来设置行间的距离。行高,
```yml
tests:
- text: '你应该给 p
标签添加 line-height
属性并赋值 25px
。'
- testString: assert($('p').css('line-height') == '25px', '你应该给 p
标签添加 line-height
属性并赋值 25px
。');
+ testString: assert($('p').css('line-height') == '25px');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-a-bezier-curve-to-move-a-graphic.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-a-bezier-curve-to-move-a-graphic.chinese.md
index 4b8fb6ee58..c7f46a65ae 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-a-bezier-curve-to-move-a-graphic.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-a-bezier-curve-to-move-a-graphic.chinese.md
@@ -26,11 +26,11 @@ localeTitle: 使用贝塞尔曲线移动图形
```yml
tests:
- text: 'id 为 red
的元素的 animation-timing-function
属性应当赋为 cubic-bezier
函数,其中 x1,y1,x2,y2 值分别为 0,0,0.58,1。'
- testString: assert($('#red').css('animation-timing-function') == 'cubic-bezier(0, 0, 0.58, 1)', 'id 为 red
的元素的 animation-timing-function
属性应当赋为 cubic-bezier
函数,其中 x1,y1,x2,y2 值分别为 0,0,0.58,1。');
+ testString: assert($('#red').css('animation-timing-function') == 'cubic-bezier(0, 0, 0.58, 1)');
- text: 'id 为 red
的元素的 animation-timing-function
属性不应该取值 linear。'
- testString: assert($('#red').css('animation-timing-function') !== 'linear', 'id 为 red
的元素的 animation-timing-function
属性不应该取值 linear。');
+ testString: assert($('#red').css('animation-timing-function') !== 'linear');
- text: 'id 为 blue
的元素的 animation-timing-function
属性不应该被改变。'
- testString: assert($('#blue').css('animation-timing-function') == 'ease-out', 'id 为 blue
的元素的 animation-timing-function
属性不应该被改变。');
+ testString: const blueBallAnimation = $('#blue').css('animation-timing-function').replace(/\s/g, ''); assert(blueBallAnimation == 'ease-out' || blueBallAnimation == 'cubic-bezier(0,0,0.58,1)');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-a-css-linear-gradient-to-create-a-striped-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-a-css-linear-gradient-to-create-a-striped-element.chinese.md
index 3f6bd1f342..6da5db0074 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-a-css-linear-gradient-to-create-a-striped-element.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-a-css-linear-gradient-to-create-a-striped-element.chinese.md
@@ -28,17 +28,17 @@ localeTitle: 使用 CSS 线性渐变创建条纹元素
```yml
tests:
- text: 'repeating-linear-gradient()
的渐变角度应该为 45deg
。'
- testString: 'assert(code.match(/background:\s*?repeating-linear-gradient\(\s*?45deg/gi), ''repeating-linear-gradient()
的渐变角度应该为 45deg
。'');'
+ testString: assert(code.match(/background:\s*?repeating-linear-gradient\(\s*?45deg/gi));
- text: 'repeating-linear-gradient()
的渐变角度应该不在是 90deg
。'
- testString: assert(!code.match(/90deg/gi), 'repeating-linear-gradient()
的渐变角度不应该是 90deg
。');
+ testString: assert(!code.match(/90deg/gi));
- text: '0px
处的渐变颜色应该为 yellow
。'
- testString: assert(code.match(/yellow\s+?0px/gi), '0px
处的渐变颜色应该为 yellow
。');
+ testString: assert(code.match(/yellow\s+?0(px)?/gi));
- text: '40px
处的第一个渐变颜色应该为 yellow
。'
- testString: assert(code.match(/yellow\s+?40px/gi), '40px
处的第一个渐变颜色应该为 yellow
。');
+ testString: assert(code.match(/yellow\s+?40px/gi));
- text: '40px
处的第二个渐变颜色应该为 black
。'
- testString: assert(code.match(/yellow\s+?40px,\s*?black\s+?40px/gi), '40px
处的第二个渐变颜色应该为 black
。');
+ testString: assert(code.match(/yellow\s+?40px,\s*?black\s+?40px/gi));
- text: '80px
处最后一个渐变颜色应该为 black
。'
- testString: assert(code.match(/black\s+?80px/gi), '80px
处最后一个渐变颜色应该为 black
。');
+ testString: assert(code.match(/black\s+?80px/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-css-animation-to-change-the-hover-state-of-a-button.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-css-animation-to-change-the-hover-state-of-a-button.chinese.md
index 4688c4d852..2f1ba84c66 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-css-animation-to-change-the-hover-state-of-a-button.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-css-animation-to-change-the-hover-state-of-a-button.chinese.md
@@ -43,9 +43,9 @@ localeTitle: 使用CSS动画更改按钮的悬停状态
```yml
tests:
- text: '@keyframes
规则的 animation-name
应该是 background-color。'
- testString: assert(code.match(/@keyframes\s+?background-color\s*?{/g), '@keyframes
规则的 animation-name
应该是 background-color。');
+ testString: assert(code.match(/@keyframes\s+?background-color\s*?{/g));
- text: '在 @keyframes
的 100%
条目里应该把 background-color
改成 #4791d0
。'
- testString: 'assert(code.match(/100%\s*?{\s*?background-color:\s*?#4791d0;\s*?}/gi), ''在 @keyframes
的 100%
条目里应该把 background-color
改成 #4791d0
。'');'
+ testString: assert(code.match(/100%\s*?{\s*?background-color:\s*?#4791d0;\s*?}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-css-transform-property-skewx-to-skew-an-element-along-the-x-axis.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-css-transform-property-skewx-to-skew-an-element-along-the-x-axis.chinese.md
index 3a4b88d491..57de562810 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-css-transform-property-skewx-to-skew-an-element-along-the-x-axis.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-css-transform-property-skewx-to-skew-an-element-along-the-x-axis.chinese.md
@@ -31,7 +31,7 @@ p {
```yml
tests:
- text: 'id 为 bottom
的元素应该沿着 X 轴翻转 24 度。'
- testString: 'assert(code.match(/#bottom\s*?{\s*?.*?\s*?transform:\s*?skewX\(24deg\);/g), ''id 为 bottom
的元素应该沿着 X 轴翻转 24 度。'');'
+ testString: assert(code.match(/#bottom\s*?{\s*?.*?\s*?transform:\s*?skewX\(24deg\);/g));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-css-transform-property-skewy-to-skew-an-element-along-the-y-axis.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-css-transform-property-skewy-to-skew-an-element-along-the-y-axis.chinese.md
index 6099afe294..2c02f55f68 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-css-transform-property-skewy-to-skew-an-element-along-the-y-axis.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-css-transform-property-skewy-to-skew-an-element-along-the-y-axis.chinese.md
@@ -23,7 +23,7 @@ localeTitle: 使用 CSS Transform skex 属性沿Y轴倾斜元素
```yml
tests:
- text: 'id 为 top
的元素应该沿着 Y 轴翻转 -10 度。'
- testString: 'assert(code.match(/#top\s*?{\s*?.*?\s*?transform:\s*?skewY\(-10deg\);/g), ''id 为 top
的元素应该沿着 Y 轴翻转 -10 度。'');'
+ testString: assert(code.match(/#top\s*?{\s*?.*?\s*?transform:\s*?skewY\(-10deg\);/g));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-css-transform-scale-property-to-change-the-size-of-an-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-css-transform-scale-property-to-change-the-size-of-an-element.chinese.md
index 05c2f636e9..1d6c34ba04 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-css-transform-scale-property-to-change-the-size-of-an-element.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-css-transform-scale-property-to-change-the-size-of-an-element.chinese.md
@@ -30,7 +30,7 @@ p {
```yml
tests:
- text: '#ball2
的 transform
属性应该为原始大小的 1.5 倍。'
- testString: 'assert(code.match(/#ball2\s*?{\s*?left:\s*?65%;\s*?transform:\s*?scale\(1\.5\);\s*?}|#ball2\s*?{\s*?transform:\s*?scale\(1\.5\);\s*?left:\s*?65%;\s*?}/gi), ''#ball2
的 transform
属性应该为原始大小的 1.5 倍。'');'
+ testString: assert(code.match(/#ball2\s*?{\s*?left:\s*?65%;\s*?transform:\s*?scale\(1\.5\);\s*?}|#ball2\s*?{\s*?transform:\s*?scale\(1\.5\);\s*?left:\s*?65%;\s*?}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-css-transform-scale-property-to-scale-an-element-on-hover.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-css-transform-scale-property-to-scale-an-element-on-hover.chinese.md
index 0d05dfdf0f..1267652b5d 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-css-transform-scale-property-to-scale-an-element-on-hover.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-css-transform-scale-property-to-scale-an-element-on-hover.chinese.md
@@ -33,7 +33,7 @@ p:hover {
```yml
tests:
- text: 'div
元素在悬停时大小应该缩放到原始大小的 1.1 倍。'
- testString: 'assert(code.match(/div:hover\s*?{\s*?transform:\s*?scale\(1\.1\);/gi), ''div
元素在悬停时大小应该缩放到原始大小的 1.1 倍。'');'
+ testString: assert(code.match(/div:hover\s*?{\s*?transform:\s*?scale\(1\.1\);/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-em-tag-to-italicize-text.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-em-tag-to-italicize-text.chinese.md
index ffd34626f6..a3b17e27f4 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-em-tag-to-italicize-text.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-em-tag-to-italicize-text.chinese.md
@@ -24,9 +24,9 @@ localeTitle: 使用 em 标签强调文本
```yml
tests:
- text: '你应该添加一个 em
标签。'
- testString: assert($('em').length == 1, '你应该添加一个 em
标签。');
+ testString: assert($('em').length == 1);
- text: 'em
标签应该嵌套在 p
标签里面。'
- testString: assert($('p').children().length == 1 && $('em').children().length == 2, 'em
标签应该嵌套在 p
标签里面。');
+ testString: assert($('p').children().length == 1 && $('em').children().length == 2);
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-s-tag-to-strikethrough-text.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-s-tag-to-strikethrough-text.chinese.md
index 4ca03cadff..ca23172aa9 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-s-tag-to-strikethrough-text.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-s-tag-to-strikethrough-text.chinese.md
@@ -24,11 +24,11 @@ localeTitle: 使用 s 标签给文本添加删除线
```yml
tests:
- text: '你应该添加一个 s
标签。'
- testString: assert($('s').length == 1, '你应该添加一个s
标签。');
+ testString: assert($('s').length == 1);
- text: ' s
标签应该在 h4
标签内的 Google 文字外面,它不应该包含单词 Alphabet。'
- testString: assert($('s').text().match(/Google/gi) && !$('s').text().match(/Alphabet/gi), 's
标签应该在 h4
标签内的 Google 文字外面,它不应该包含单词 Alphabet。');
+ testString: assert($('h4 > s').text().match(/Google/gi) && !$('h4 > s').text().match(/Alphabet/gi));
- text: 'h4
标签内应该有单词 Alphabet,Alphabet 应该没有删除线样式。'
- testString: assert($('h4').html().match(/Alphabet/gi), 'h4
标签内应该有单词 Alphabet,Alphabet 应该没有删除线样式。');
+ testString: assert($('h4').html().match(/Alphabet/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-strong-tag-to-make-text-bold.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-strong-tag-to-make-text-bold.chinese.md
index d3f35ed73e..d43fd0949b 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-strong-tag-to-make-text-bold.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-strong-tag-to-make-text-bold.chinese.md
@@ -24,11 +24,11 @@ localeTitle: 使用 strong 标签加粗文本
```yml
tests:
- text: '你应该有一个 strong
标签。'
- testString: assert($('strong').length == 1, '你应该有一个 strong
标签。');
+ testString: assert($('strong').length == 1);
- text: 'strong
标签应该在 p
标签里。'
- testString: assert($('p').children('strong').length == 1, 'strong
标签应该在 p
标签里。');
+ testString: assert($('p').children('strong').length == 1);
- text: 'strong
标签应该包围 “斯坦福大学”。'
- testString: assert($('strong').text().match(/^斯坦福大学$/gi), 'strong
标签应该包围 “斯坦福大学”。');
+ testString: assert($('strong').text().match(/^Stanford University$/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-text-transform-property-to-make-text-uppercase.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-text-transform-property-to-make-text-uppercase.chinese.md
index 9667d6e060..7875ee58e0 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-text-transform-property-to-make-text-uppercase.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-visual-design/use-the-text-transform-property-to-make-text-uppercase.chinese.md
@@ -25,9 +25,9 @@ CSS 里面的 text-transform
属性来改变英文中字母的大
```yml
tests:
- text: 'h4
内的英文的所有字母应该为大写。'
- testString: assert($('h4').css('text-transform') === 'uppercase', 'h4
内的英文的所有字母应该为大写。');
+ testString: assert($('h4').css('text-transform') === 'uppercase');
- text: 'h4
内的原文不能被改变。'
- testString: assert(($('h4').text() !== $('h4').text().toUpperCase()), 'h4
内的原文不能被改变。');
+ testString: assert(($('h4').text() !== $('h4').text().toUpperCase()));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-borders-around-your-elements.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-borders-around-your-elements.chinese.md
index 086596bea1..a1780e17e4 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-borders-around-your-elements.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-borders-around-your-elements.chinese.md
@@ -120,5 +120,6 @@ tests:
```html
// solution required
```
+
\ No newline at end of file
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-different-padding-to-each-side-of-an-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-different-padding-to-each-side-of-an-element.chinese.md
index c842b02622..5f43a585f3 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-different-padding-to-each-side-of-an-element.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-different-padding-to-each-side-of-an-element.chinese.md
@@ -94,5 +94,6 @@ tests:
```html
// solution required
```
+
\ No newline at end of file
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-rounded-corners-with-border-radius.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-rounded-corners-with-border-radius.chinese.md
index a5454b1514..eaf97f77b9 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-rounded-corners-with-border-radius.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/add-rounded-corners-with-border-radius.chinese.md
@@ -26,7 +26,7 @@ tests:
- text: '图片元素应具有 "thick-green-border" class 属性。'
testString: assert($("img").hasClass("thick-green-border"));
- text: '图片应含有10px
的边框圆角。'
- testString: assert(parseInt($("img").css("border-top-left-radius")) > 8);
+ testString: assert($("img").css("border-top-left-radius") === '10px' && $("img").css("border-top-right-radius") === '10px' && $("img").css("border-bottom-left-radius") === '10px' && $("img").css("border-bottom-right-radius") === '10px');
```
@@ -109,5 +109,6 @@ tests:
```html
// solution required
```
+
\ No newline at end of file
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/adjust-the-margin-of-an-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/adjust-the-margin-of-an-element.chinese.md
index 597c6f80c5..3f1a4db583 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/adjust-the-margin-of-an-element.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/adjust-the-margin-of-an-element.chinese.md
@@ -86,7 +86,7 @@ tests:
## Solution
penguin-top
class 的background
属性应设置一个black
备用颜色。'
- testString: 'assert(code.match(/.penguin-top\s*?{[\s\S]*background\s*?:\s*?var\(\s*?--pengiun-skin\s*?,\s*?black\s*?\)\s*?;[\s\S]*}[\s\S]*.penguin-bottom\s{/gi));'
+ testString: assert(code.match(/.penguin-top\s*?{[\s\S]*background\s*?:\s*?var\(\s*?--pengiun-skin\s*?,\s*?black\s*?\)\s*?;[\s\S]*}[\s\S]*.penguin-bottom\s{/gi));
- text: 'penguin-bottom
class 的background
属性应设置一个black
备用颜色。'
- testString: 'assert(code.match(/.penguin-bottom\s*?{[\s\S]*background\s*?:\s*?var\(\s*?--pengiun-skin\s*?,\s*?black\s*?\)\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.penguin-bottom\s*?{[\s\S]*background\s*?:\s*?var\(\s*?--pengiun-skin\s*?,\s*?black\s*?\)\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-a-variable-for-a-specific-area.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-a-variable-for-a-specific-area.chinese.md
index 5ae51176cf..2a3a2dcfe0 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-a-variable-for-a-specific-area.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-a-variable-for-a-specific-area.chinese.md
@@ -25,7 +25,7 @@ localeTitle: 更改特定区域的变量
```yml
tests:
- text: '应该在penguin
clas 里重定义--penguin-belly
的变量值,且它的值为white
。'
- testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-belly\s*?:\s*?white\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.penguin\s*?{[\s\S]*--penguin-belly\s*?:\s*?white\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-the-color-of-text.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-the-color-of-text.chinese.md
index 72e3afa499..2acc235d94 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-the-color-of-text.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-the-color-of-text.chinese.md
@@ -27,9 +27,9 @@ localeTitle: 更改文本的颜色
```yml
tests:
- text: 'h2
元素应该为红色。'
- testString: assert($("h2").css("color") === "rgb(255, 0, 0)");
+ testString: assert($("h2").attr('style'));
- text: 'h2
元素的style
属性值应该以;
结束。'
- testString: 'assert(code.match(/\s*CatPhotoApp\s*<\/h2>/));'
+ testString: assert($("h2").css("color") === "rgb(255, 0, 0)");
- text: '
style
声明应该以 ;
结尾'
testString: assert($("h2").attr('style') && $("h2").attr('style').endsWith(';'));
@@ -88,5 +88,6 @@ tests:
```html
// solution required
```
+
\ No newline at end of file
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-the-font-size-of-an-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-the-font-size-of-an-element.chinese.md
index 910042229b..94a33555a0 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-the-font-size-of-an-element.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/change-the-font-size-of-an-element.chinese.md
@@ -30,7 +30,7 @@ h1 {
```yml
tests:
- text: '在style
样式声明区域里,p
元素的font-size
的值应为16px
,浏览器和文本缩放应设置为 100%。'
- testString: 'assert(code.match(/p\s*{\s*font-size\s*:\s*16\s*px\s*;\s*}/i));'
+ testString: assert(code.match(/p\s*{\s*font-size\s*:\s*16\s*px\s*;\s*}/i));
```
@@ -93,5 +93,6 @@ tests:
```html
// solution required
```
+
\ No newline at end of file
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/create-a-custom-css-variable.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/create-a-custom-css-variable.chinese.md
index 35766529a7..d1218b2c8a 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/create-a-custom-css-variable.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/create-a-custom-css-variable.chinese.md
@@ -30,7 +30,7 @@ localeTitle: 创建一个自定义的 CSS 变量
```yml
tests:
- text: 'penguin
class 里应声明--penguin-skin
变量,且赋值为gray
。'
- testString: 'assert(code.match(/.penguin\s*?{[\s\S]*--penguin-skin\s*?:\s*?gray\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.penguin\s*?{[\s\S]*--penguin-skin\s*?:\s*?gray\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/import-a-google-font.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/import-a-google-font.chinese.md
index b4adc29fb0..6cc5f64d69 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/import-a-google-font.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/import-a-google-font.chinese.md
@@ -30,11 +30,11 @@ localeTitle: 引入谷歌字体
```yml
tests:
- text: '引入Lobster
字体。'
- testString: assert(new RegExp("gdgdocs|googleapis", "gi").test(code));
+ testString: assert(new RegExp("googleapis", "gi").test(code));
- text: 'h2
元素必须使用Lobster
字体。'
testString: assert($("h2").css("font-family").match(/lobster/i));
- text: '使用h2
选择器去改变字体样式。'
- testString: 'assert(/\s*h2\s*\{\s*font-family\:\s*(\''|")?Lobster(\''|")?\s*;\s*\}/gi.test(code));'
+ testString: 'assert(/\s*h2\s*\{\s*font-family\:\s*(\"|")?Lobster(\"|")?(.{0,})\s*;\s*\}/gi.test(code));'
- text: 'p
元素应该保持使用monospace
字体。'
testString: assert($("p").css("font-family").match(/monospace/i));
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/inherit-styles-from-the-body-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/inherit-styles-from-the-body-element.chinese.md
index 29ca58034f..0d1289291e 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/inherit-styles-from-the-body-element.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/inherit-styles-from-the-body-element.chinese.md
@@ -30,7 +30,7 @@ tests:
- text: 'h1
元素的文本内容应该为Hello World
。'
testString: assert(($("h1").length > 0 && $("h1").text().match(/hello world/i)));
- text: '确保h1
元素具有结束标记。'
- testString: assert(code.match(/<\/h1>/g) && code.match(//g).length === code.match(/
h1元素具有结束标记。');
+ testString: assert(code.match(/<\/h1>/g) && code.match(/
/g).length === code.match(/
body元素的
color
属性值应为green
。'
testString: assert(($("body").css("color") === "rgb(0, 128, 0)"));
- text: 'body
元素的font-family
属性值应为monospace
。'
@@ -70,5 +70,6 @@ tests:
```html
// solution required
```
+
\ No newline at end of file
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/make-circular-images-with-a-border-radius.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/make-circular-images-with-a-border-radius.chinese.md
index bf2eba8539..bede6ced48 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/make-circular-images-with-a-border-radius.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/make-circular-images-with-a-border-radius.chinese.md
@@ -25,7 +25,7 @@ tests:
- text: '你图片的边框圆角应设置为50%
,让它看起来就像一个完整的圆。'
testString: assert(parseInt($("img").css("border-top-left-radius")) > 48);
- text: '请确保百分值为50%
。'
- testString: assert(code.match(/50%/g), '请确保百分值为50%
。');
+ testString: assert(code.match(/50%/g));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/override-all-other-styles-by-using-important.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/override-all-other-styles-by-using-important.chinese.md
index 07e2b71d0f..f582228a22 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/override-all-other-styles-by-using-important.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/override-all-other-styles-by-using-important.chinese.md
@@ -35,9 +35,9 @@ tests:
- text: 'h1
元素应该包含一个名为orange-text
的id。'
testString: assert($("h1").attr("id") === "orange-text");
- text: 'h1
元素应该包含color: white
的行内样式声明。'
- testString: 'assert(code.match(/!important
关键字。'
- testString: 'assert(code.match(/\.pink-text\s*?\{[\s\S]*?color:.*pink.*!important\s*;?[^\.]*\}/g));'
+ testString: assert(code.match(/\.pink-text\s*?\{[\s\S]*?color:.*pink.*!important\s*;?[^\.]*\}/g));
- text: 'h1
元素的字体颜色应该为粉色。'
testString: assert($("h1").css("color") === "rgb(255, 192, 203)");
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/prioritize-one-style-over-another.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/prioritize-one-style-over-another.chinese.md
index c3a15e8cf7..f7ef5ab770 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/prioritize-one-style-over-another.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/prioritize-one-style-over-another.chinese.md
@@ -28,7 +28,7 @@ tests:
- text: 'h1
元素应该含有pink-text
class。'
testString: assert($("h1").hasClass("pink-text"));
- text: '<style>
标签应该含有一个可以改变字体颜色的pink-text
class。'
- testString: 'assert(code.match(/\.pink-text\s*\{\s*color\s*:\s*.+\s*;\s*\}/g));'
+ testString: assert(code.match(/\.pink-text\s*\{\s*color\s*:\s*.+\s*;\s*\}/g));
- text: 'h1
元素的字体颜色应该为pink(粉色)
。'
testString: assert($("h1").css("color") === "rgb(255, 192, 203)");
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/set-the-id-of-an-element.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/set-the-id-of-an-element.chinese.md
index da842d92b2..58509eb689 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/set-the-id-of-an-element.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/set-the-id-of-an-element.chinese.md
@@ -115,5 +115,6 @@ tests:
```html
// solution required
```
+
\ No newline at end of file
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/size-your-images.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/size-your-images.chinese.md
index 39905bb0c5..e8727b3457 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/size-your-images.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/size-your-images.chinese.md
@@ -34,7 +34,7 @@ CSS 的width
属性可以控制元素的宽度。图片的widt
```yml
tests:
- text: '
属性均为img
元素应该含有smaller-image
class。'
- testString: 'assert($("img[src=''https://bit.ly/fcc-relaxing-cat'']").attr(''class'') === "smaller-image");'
+ testString: assert($("img[src='https://bit.ly/fcc-relaxing-cat']").attr('class') === "smaller-image");
- text: '图片宽度应为 100px(像素),且浏览器缩放应为默认 100%。'
testString: assert($("img").width() === 100);
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/specify-how-fonts-should-degrade.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/specify-how-fonts-should-degrade.chinese.md
index 0eacb1a9fb..6d5dfd737d 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-css/specify-how-fonts-should-degrade.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-css/specify-how-fonts-should-degrade.chinese.md
@@ -37,7 +37,7 @@ tests:
- text: 'h2
元素应该含有Lobster
字体。'
testString: assert($("h2").css("font-family").match(/^"?lobster/i));
- text: '当Lobster
字体失效时,h2
元素应该降级使用monospace
字体。'
- testString: 'assert(/\s*h2\s*\{\s*font-family\:\s*(\''|")?Lobster(\''|")?,\s*monospace\s*;\s*\}/gi.test(code));'
+ testString: assert(/\s*h2\s*\{\s*font-family\:\s*(\'|")?Lobster(\'|")?,\s*monospace\s*;\s*\}/gi.test(code));
- text: '通过添加<!--
,注释掉谷歌Lobster
字体的引入。'
testString: assert(new RegExp("/g).length > 1);
- text: '不要更改h1
元素、h2
元素、p
元素的顺序。'
- testString: assert((code.match(/<([a-z0-9]){1,2}>/g)[0]==="" && code.match(/<([a-z0-9]){1,2}>/g)[1]==="
" && code.match(/<([a-z0-9]){1,2}>/g)[2]==="
" && code.match(/<([a-z0-9]){1,2}>/g)[1]==="
" && code.match(/<([a-z0-9]){1,2}>/g)[2]==="
label
元素中。'
- testString: 'assert($(''label > input[type="checkbox"]:only-child'').length > 2);'
+ testString: assert($('label > input[type="checkbox"]:only-child').length > 2);
- text: '确保label
元素有结束标记。'
testString: assert(code.match(/<\/label>/g) && code.match(/personality
。'
- testString: assert($('label > input[type="checkbox"]').filter("[name='personality']").length > 2);
+ testString: assert($('label > input[type="checkbox"]').filter('[name="personality"]').length > 2);
- text: '每个复选框都应该在 form
标签内。'
testString: assert($('label').parent().get(0).tagName.match('FORM'));
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/create-a-set-of-radio-buttons.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/create-a-set-of-radio-buttons.chinese.md
index 39ef131e32..8659dc0053 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/create-a-set-of-radio-buttons.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/create-a-set-of-radio-buttons.chinese.md
@@ -44,9 +44,9 @@ tests:
- text: '页面上应该有两个单选按钮元素。'
testString: assert($('input[type="radio"]').length > 1);
- text: '设置单选按钮的name
属性为indoor-outdoor
。'
- testString: assert($('label > input[type="radio"]').filter("[name='indoor-outdoor']").length > 1);
+ testString: assert($('input[type="radio"]').filter("[name='indoor-outdoor']").length > 1);
- text: '每一个单选按钮都应该嵌套进它自己的label
元素中。'
- testString: 'assert($(''label > input[type="radio"]:only-child'').length > 1);'
+ testString: assert($('label > input[type="radio"]:only-child').length > 1);
- text: '每一个label
元素都有结束标记。'
testString: assert((code.match(/<\/label>/g) && code.match(/indoor
。'
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/create-an-ordered-list.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/create-an-ordered-list.chinese.md
index baac81b4c8..197b43349b 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/create-an-ordered-list.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/create-an-ordered-list.chinese.md
@@ -35,9 +35,9 @@ HTML 有一个特定的元素用于创建有序列表ordered lists(缩
```yml
tests:
- text: '页面应该有一个无序列表,内容是猫咪最喜欢的三件东西。'
- testString: assert((/猫咪最喜欢的三件东西:/i).test($("ul").prev().text()));
+ testString: assert((/Top 3 things cats hate:/i).test($("ol").prev().text()));
- text: '页面应该有一个有序列表,内容是猫咪最讨厌的三件东西。'
- testString: assert((/猫咪最讨厌的三件东西:/i).test($("ol").prev().text()));
+ testString: assert((/Things cats love:/i).test($("ul").prev().text()));
- text: '页面应该只有一个
。'
- testString: 'assert(($("a[href=\"http://freecatphotoapp.com\"]").length > 0 || $("a[href=\"http://www.freecatphotoapp.com\"]").length > 0));'
+ testString: assert(($("a[href=\"http://freecatphotoapp.com\"]").length > 0 || $("a[href=\"http://www.freecatphotoapp.com\"]").length > 0));
- text: 'ul
元素。'
testString: assert.equal($("ul").length, 1);
- text: '页面应该只有一个ol
元素。'
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/define-the-head-and-body-of-an-html-document.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/define-the-head-and-body-of-an-html-document.chinese.md
index c235bf7db6..30cb9ba496 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/define-the-head-and-body-of-an-html-document.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/define-the-head-and-body-of-an-html-document.chinese.md
@@ -48,7 +48,7 @@ tests:
- text: 'title
应该是head
的子元素。'
testString: assert(code.match(/\s*?h1
和p
都应该是body
的子元素。'
- testString: assert($('body').children('h1').length == 1 && $('body').children('p').length == 1);
+ testString: assert(code.match(/\s*?.*?\s*?<\/h1>\s*?)(
(.*\s*)*?<\/h1>\s*?)))<\/body>/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/delete-html-elements.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/delete-html-elements.chinese.md
index 5097ab282b..ccbb6f79fb 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/delete-html-elements.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/delete-html-elements.chinese.md
@@ -24,11 +24,11 @@ localeTitle: 删除 HTML 元素
```yml
tests:
- text: '删除
h1
元素。'
- testString: assert(($("h1").length == 0));
+ testString: assert(!code.match(//gi) && !code.match(/<\/h1>/gi));
- text: '保留
h2
元素。'
- testString: assert(($("h2").length > 0));
+ testString: assert(code.match(/[\w\W]*<\/h2>/gi));
- text: '保留
p
元素。'
- testString: assert(($("p").length > 0));
+ testString: assert(code.match(/h2
元素应该有结束标记。'
testString: assert(code.match(/<\/h2>/g) && code.match(/<\/h2>/g).length === code.match(//g).length);
- text: '
h2
元素的内容应为:CatPhotoApp
。'
- testString: assert.isTrue((/CatPhotoApp/gi).test($("h2").text()));
+ testString: assert.isTrue((/cat(\s)?photo(\s)?app/gi).test($("h2").text()));
- text: 'h1
元素的内容应为:Hello World
。'
testString: assert.isTrue((/hello(\s)+world/gi).test($("h1").text()));
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/introduction-to-html5-elements.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/introduction-to-html5-elements.chinese.md
index 7a2cfb32b9..49f0d98d3e 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/introduction-to-html5-elements.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/introduction-to-html5-elements.chinese.md
@@ -36,11 +36,11 @@ HTML5 引入了很多更具描述性的 HTML 元素,例如:header 1, '页面中应该有两个段落。');
+ testString: assert($("p").length > 1);
- text: '确保每个段落都有结束标记。'
testString: assert(code.match(/<\/p>/g) && code.match(/<\/p>/g).length === code.match(/
元素。'
testString: assert($('main').length === 1);
- text: 'main
元素应有两个 p
元素作为它的子元素。'
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/link-to-external-pages-with-anchor-elements.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/link-to-external-pages-with-anchor-elements.chinese.md
index d7dfdcb43b..ab95ce2f35 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/link-to-external-pages-with-anchor-elements.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/link-to-external-pages-with-anchor-elements.chinese.md
@@ -28,7 +28,7 @@ tests:
- text: 'a
元素的 a
文本应为:cat photos
。'
testString: assert((/cat photos/gi).test($("a").text()));
- text: 'a
元素的href
属性应为:"http://freecatphotoapp
"。'
- testString: 'assert(/http:\/\/(www\.)?freecatphotoapp\.com/gi.test($("a").attr("href")));'
+ testString: assert(/http:\/\/(www\.)?freecatphotoapp\.com/gi.test($("a").attr("href")));
- text: '确保a
元素有结束标记。'
testString: assert(code.match(/<\/a>/g) && code.match(/<\/a>/g).length === code.match(/aa
的文本应为:cat photos。'
testString: assert($("a").text().match(/cat\sphotos/gi));
- text: '在 a
的外部创建一个新段落,这样页面就有 3 个段落了。'
testString: assert($("p") && $("p").length > 2);
- text: 'a
应嵌套在新段落内。'
- testString: 'assert(($("a[href=\"http://freecatphotoapp.com\"]").parent().is("p") || $("a[href=\"http://www.freecatphotoapp.com\"]").parent().is("p")));'
+ testString: assert(($("a[href=\"http://freecatphotoapp.com\"]").parent().is("p") || $("a[href=\"http://www.freecatphotoapp.com\"]").parent().is("p")));
- text: '段落应该包含文本 View more(记得 more 后面有一个空格)。'
- testString: 'assert(($("a[href=\"http://freecatphotoapp.com\"]").parent().text().match(/View\smore\s/gi) || $("a[href=\"http://www.freecatphotoapp.com\"]").parent().text().match(/View\smore\s/gi)));'
+ testString: assert(($("a[href=\"http://freecatphotoapp.com\"]").parent().text().match(/View\smore\s/gi) || $("a[href=\"http://www.freecatphotoapp.com\"]").parent().text().match(/View\smore\s/gi)));
- text: 'a
不应该包含文本 View more。'
testString: assert(!$("a").text().match(/View\smore/gi));
- text: '确保每个段落有结束标记。'
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/say-hello-to-html-elements.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/say-hello-to-html-elements.chinese.md
index 6912c1dc69..7f845b346f 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/say-hello-to-html-elements.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/say-hello-to-html-elements.chinese.md
@@ -30,7 +30,7 @@ HTML 是英文 Hyper Text Markup Language(超文本标记语言)的缩写。
```yml
tests:
- text: 'h1
元素的内容应该为:Hello World
。'
- testString: assert.isTrue((/^hello(\s)+world$/gi).test($('h1').text()));
+ testString: assert.isTrue((/hello(\s)+world/gi).test($('h1').text()));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/uncomment-html.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/uncomment-html.chinese.md
index 79a45c51b7..639f2f3e77 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/uncomment-html.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/uncomment-html.chinese.md
@@ -31,7 +31,7 @@ tests:
- text: '确保网页中能看到p
元素。'
testString: assert($("p").length > 0);
- text: '确保删除了注释的结束标记-->
。'
- testString: assert(!/[^fc]-->/gi.test(code.replace(/ *")')[1]);
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/add-flex-superpowers-to-the-tweet-embed.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/add-flex-superpowers-to-the-tweet-embed.chinese.md
index 4777bc0d49..fca5a233f4 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/add-flex-superpowers-to-the-tweet-embed.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/add-flex-superpowers-to-the-tweet-embed.chinese.md
@@ -24,19 +24,19 @@ localeTitle: 在推文中添加弹性盒子布局
```yml
tests:
- text: 'header
的display
属性应为 flex。'
- testString: assert($('header').css('display') == 'flex', 'header
的display
属性应为 flex。');
+ testString: assert($('header').css('display') == 'flex');
- text: 'footer
的display
属性应为 flex。'
- testString: assert($('footer').css('display') == 'flex', 'footer
的display
属性应为 flex。');
+ testString: assert($('footer').css('display') == 'flex');
- text: 'h3
的display
属性应为 flex。'
- testString: assert($('h3').css('display') == 'flex', 'h3
的display
属性应为 flex。');
+ testString: assert($('h3').css('display') == 'flex');
- text: 'h4
的display
属性应为 flex。'
- testString: assert($('h4').css('display') == 'flex', 'h4
的display
属性应为 flex。');
+ testString: assert($('h4').css('display') == 'flex');
- text: '.profile-name
的display
属性应为 flex。'
- testString: assert($('.profile-name').css('display') == 'flex', '.profile-name
的display
属性应为 flex。');
+ testString: assert($('.profile-name').css('display') == 'flex');
- text: '.follow-btn
的display
属性应为 flex。'
- testString: assert($('.follow-btn').css('display') == 'flex', '.follow-btn
的display
属性应为 flex。');
+ testString: assert($('.follow-btn').css('display') == 'flex');
- text: '.stats
的display
属性应为 flex。'
- testString: assert($('.stats').css('display') == 'flex', '.stats
的display
属性应为 flex。');
+ testString: assert($('.stats').css('display') == 'flex');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/align-elements-using-the-align-items-property.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/align-elements-using-the-align-items-property.chinese.md
index 931b6b9b44..b1c8f77d32 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/align-elements-using-the-align-items-property.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/align-elements-using-the-align-items-property.chinese.md
@@ -28,7 +28,7 @@ Flex 容器中,与主轴垂直的叫做 cross axis(交叉轴)#box-container元素应有align-items
属性,其值应为 center。'
- testString: assert($('#box-container').css('align-items') == 'center', '#box-container
元素应有align-items
属性,其值应为 center。');
+ testString: assert($('#box-container').css('align-items') == 'center');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/align-elements-using-the-justify-content-property.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/align-elements-using-the-justify-content-property.chinese.md
index 65b43f81c3..11050d4edd 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/align-elements-using-the-justify-content-property.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/align-elements-using-the-justify-content-property.chinese.md
@@ -29,7 +29,7 @@ flex 子元素有时不能充满整个 flex 容器,所以我们经常需要告
```yml
tests:
- text: '#box-container
应有justify-content
属性,其值应为 center。'
- testString: assert($('#box-container').css('justify-content') == 'center', '#box-container
应有justify-content
属性,其值应为 center。');
+ testString: assert($('#box-container').css('justify-content') == 'center');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/apply-the-flex-direction-property-to-create-a-column-in-the-tweet-embed.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/apply-the-flex-direction-property-to-create-a-column-in-the-tweet-embed.chinese.md
index 02ef4bc686..b8c2d39d9c 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/apply-the-flex-direction-property-to-create-a-column-in-the-tweet-embed.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/apply-the-flex-direction-property-to-create-a-column-in-the-tweet-embed.chinese.md
@@ -23,7 +23,7 @@ localeTitle: 使用 flex-direction 在嵌入推文中创建一列
```yml
tests:
- text: '.profile-name
应有flex-direction
属性,其值应为 column。'
- testString: assert($('.profile-name').css('flex-direction') == 'column', '.profile-name
应有flex-direction
属性,其值应为 column。');
+ testString: assert($('.profile-name').css('flex-direction') == 'column');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/apply-the-flex-direction-property-to-create-rows-in-the-tweet-embed.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/apply-the-flex-direction-property-to-create-rows-in-the-tweet-embed.chinese.md
index 6be6b956fd..319fcf3aff 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/apply-the-flex-direction-property-to-create-rows-in-the-tweet-embed.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/apply-the-flex-direction-property-to-create-rows-in-the-tweet-embed.chinese.md
@@ -23,9 +23,9 @@ localeTitle: 使用 flex-direction 在嵌入推文中创建多行
```yml
tests:
- text: 'header
应有flex-direction
属性,其值应为 row。'
- testString: 'assert(code.match(/header\s*?{\s*?.*?\s*?.*?\s*?flex-direction:\s*?row;/g), ''header
应有flex-direction
属性,其值应为 row。'');'
+ testString: assert(code.match(/header\s*?{[^}]*?flex-direction:\s*?row;/g));
- text: 'footer
应有flex-direction
属性,其值应为 row。'
- testString: 'assert(code.match(/footer\s*?{\s*?.*?\s*?.*?\s*?flex-direction:\s*?row;/g), ''footer
应有flex-direction
属性,其值应为 row。'');'
+ testString: assert(code.match(/footer\s*?{[^}]*?flex-direction:\s*?row;/g));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-display-flex-to-position-two-boxes.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-display-flex-to-position-two-boxes.chinese.md
index cbd3838c67..8f49e3f810 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-display-flex-to-position-two-boxes.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-display-flex-to-position-two-boxes.chinese.md
@@ -24,7 +24,7 @@ localeTitle: '使用 display: flex 定位两个盒子'
```yml
tests:
- text: '#box-container
应有display
属性,其值应为 flex。'
- testString: assert($('#box-container').css('display') == 'flex', '#box-container
应有display
属性,其值应为 flex。');
+ testString: assert($('#box-container').css('display') == 'flex');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-align-items-property-in-the-tweet-embed.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-align-items-property-in-the-tweet-embed.chinese.md
index 44e16d3129..425367b5d1 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-align-items-property-in-the-tweet-embed.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-align-items-property-in-the-tweet-embed.chinese.md
@@ -23,7 +23,7 @@ localeTitle: 在推文中使用 align-items 属性
```yml
tests:
- text: '.follow-btn
应有align-items
属性,其值应为 center.'
- testString: assert($('.follow-btn').css('align-items') == 'center', '.follow-btn
应有align-items
属性,其值应为 center.');
+ testString: assert($('.follow-btn').css('align-items') == 'center');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-align-self-property.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-align-self-property.chinese.md
index fa10559492..7ae4b715d5 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-align-self-property.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-align-self-property.chinese.md
@@ -24,9 +24,9 @@ flex 子项目的最后一个属性是align-self
。这个属性允
```yml
tests:
- text: '#box-1
元素应有align-self
属性,其值应为 center。'
- testString: assert($('#box-1').css('align-self') == 'center', '#box-1
元素应有align-self
属性,其值应为 center。');
+ testString: assert($('#box-1').css('align-self') == 'center');
- text: '#box-2
元素应有align-self
属性,其值应为 flex-end。'
- testString: assert($('#box-2').css('align-self') == 'flex-end', '#box-2
元素应有align-self
属性,其值应为 flex-end。');
+ testString: assert($('#box-2').css('align-self') == 'flex-end');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-basis-property-to-set-the-initial-size-of-an-item.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-basis-property-to-set-the-initial-size-of-an-item.chinese.md
index d6ef7dbbe1..4e268ca43b 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-basis-property-to-set-the-initial-size-of-an-item.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-basis-property-to-set-the-initial-size-of-an-item.chinese.md
@@ -24,13 +24,13 @@ localeTitle: 使用 flex-basis 属性设置项目的初始大小
```yml
tests:
- text: '#box-1
元素应有flex-basis
属性。'
- testString: assert($('#box-1').css('flex-basis') != 'auto', '#box-1
元素应有flex-basis
属性。');
+ testString: assert($('#box-1').css('flex-basis') != 'auto');
- text: '#box-1
的flex-basis
应为10em
。'
- testString: 'assert(code.match(/#box-1\s*?{\s*?.*?\s*?.*?\s*?flex-basis:\s*?10em;/g), ''#box-1
的flex-basis
应为10em
。'');'
+ testString: assert(code.match(/#box-1\s*?{\s*?.*?\s*?.*?\s*?flex-basis:\s*?10em;/g));
- text: '#box-2
元素应有flex-basis
属性。'
- testString: assert($('#box-2').css('flex-basis') != 'auto', '#box-2
元素应有flex-basis
属性。');
+ testString: assert($('#box-2').css('flex-basis') != 'auto');
- text: '#box-2
的flex-basis
应为20em
。'
- testString: 'assert(code.match(/#box-2\s*?{\s*?.*?\s*?.*?\s*?flex-basis:\s*?20em;/g), ''#box-2
的flex-basis
应为20em
。'');'
+ testString: assert(code.match(/#box-2\s*?{\s*?.*?\s*?.*?\s*?flex-basis:\s*?20em;/g));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-direction-property-to-make-a-column.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-direction-property-to-make-a-column.chinese.md
index b8e212c9d1..7b67a9ab77 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-direction-property-to-make-a-column.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-direction-property-to-make-a-column.chinese.md
@@ -23,7 +23,7 @@ localeTitle: 使用 flex-direction 属性创建一列
```yml
tests:
- text: '#box-container
应有flex-direction
属性,其值应为 column。'
- testString: assert($('#box-container').css('flex-direction') == 'column', '#box-container
应有flex-direction
属性,其值应为 column。');
+ testString: assert($('#box-container').css('flex-direction') == 'column');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-direction-property-to-make-a-row.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-direction-property-to-make-a-row.chinese.md
index 6878f3ecce..9aa937b3e7 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-direction-property-to-make-a-row.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-direction-property-to-make-a-row.chinese.md
@@ -25,7 +25,7 @@ localeTitle: 使用 flex-direction 属性创建一行
```yml
tests:
- text: '#box-container
应有flex-direction
属性,其值应为 row-reverse。'
- testString: assert($('#box-container').css('flex-direction') == 'row-reverse', '#box-container
应有flex-direction
属性,其值应为 row-reverse。');
+ testString: assert($('#box-container').css('flex-direction') == 'row-reverse');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-grow-property-to-expand-items.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-grow-property-to-expand-items.chinese.md
index 9ef53fbadc..17f2cb2d73 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-grow-property-to-expand-items.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-grow-property-to-expand-items.chinese.md
@@ -24,9 +24,9 @@ localeTitle: 使用 flex-grow 属性扩展项目
```yml
tests:
- text: '#box-1
元素应有flex-grow
属性,其值应为 1。'
- testString: assert($('#box-1').css('flex-grow') == '1', '#box-1
元素应有flex-grow
属性,其值应为 1。');
+ testString: assert($('#box-1').css('flex-grow') == '1');
- text: '#box-2
元素应有flex-grow
属性,其值应为 2。'
- testString: assert($('#box-2').css('flex-grow') == '2', '#box-2
元素应有flex-grow
属性,其值应为 2。');
+ testString: assert($('#box-2').css('flex-grow') == '2');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-shorthand-property.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-shorthand-property.chinese.md
index 7e473fdc3f..7973ff1ff3 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-shorthand-property.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-shorthand-property.chinese.md
@@ -26,11 +26,11 @@ localeTitle: 使用 flex 短方法属性
```yml
tests:
- text: '#box-1
元素应有flex
属性,其值应为 2 2 150px。'
- testString: assert($('#box-1').css('flex-grow') == '2' && $('#box-1').css('flex-shrink') == '2' && $('#box-1').css('flex-basis') == '150px', '#box-1
元素应有flex
属性,其值应为 2 2 150px。');
+ testString: assert($('#box-1').css('flex-grow') == '2' && $('#box-1').css('flex-shrink') == '2' && $('#box-1').css('flex-basis') == '150px');
- text: '#box-2
元素应有flex
属性,其值应为 1 1 150px。'
- testString: assert($('#box-2').css('flex-grow') == '1' && $('#box-2').css('flex-shrink') == '1' && $('#box-2').css('flex-basis') == '150px', '#box-2
元素应有flex
属性,其值应为 1 1 150px。');
+ testString: assert($('#box-2').css('flex-grow') == '1' && $('#box-2').css('flex-shrink') == '1' && $('#box-2').css('flex-basis') == '150px');
- text: '应对#box-1
和#box-2
使用flex
属性。'
- testString: 'assert(code.match(/flex:\s*?\d\s+?\d\s+?150px;/g).length == 2, ''应对#box-1
和#box-2
使用flex
属性。'');'
+ testString: assert(code.match(/flex:\s*?\d\s+?\d\s+?150px;/g).length == 2);
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-shrink-property-to-shrink-items.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-shrink-property-to-shrink-items.chinese.md
index 5b5a50ce0f..2114bc89a7 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-shrink-property-to-shrink-items.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-shrink-property-to-shrink-items.chinese.md
@@ -25,9 +25,9 @@ localeTitle: 使用 flex-shrink 属性收缩项目
```yml
tests:
- text: '#box-1
元素应有flex-shrink
属性,其值应为 1.'
- testString: assert($('#box-1').css('flex-shrink') == '1', '#box-1
元素应有flex-shrink
属性,其值应为 1.');
+ testString: assert($('#box-1').css('flex-shrink') == '1');
- text: '#box-2
元素应有flex-shrink
属性,其值应为 2.'
- testString: assert($('#box-2').css('flex-shrink') == '2', '#box-2
元素应有flex-shrink
属性,其值应为 2.');
+ testString: assert($('#box-2').css('flex-shrink') == '2');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-wrap-property-to-wrap-a-row-or-column.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-wrap-property-to-wrap-a-row-or-column.chinese.md
index 1279a4d085..193c61d294 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-wrap-property-to-wrap-a-row-or-column.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-flex-wrap-property-to-wrap-a-row-or-column.chinese.md
@@ -26,7 +26,7 @@ CSS flexbox 有一个把 flex 子元素拆分为多行(或多列)的特性
```yml
tests:
- text: '#box-container
元素应有flex-wrap
属性,其值应为 wrap。'
- testString: assert($('#box-container').css('flex-wrap') == 'wrap', '#box-container
元素应有flex-wrap
属性,其值为 wrap。');
+ testString: assert($('#box-container').css('flex-wrap') == 'wrap');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-justify-content-property-in-the-tweet-embed.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-justify-content-property-in-the-tweet-embed.chinese.md
index 6952382751..ee8e4cf58d 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-justify-content-property-in-the-tweet-embed.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-justify-content-property-in-the-tweet-embed.chinese.md
@@ -23,7 +23,7 @@ localeTitle: 在推文中使用 justify-content 属性
```yml
tests:
- text: '.profile-name
元素的justify-content
属性可选以下值:center、flex-start、flex-end、space-between、space-around。'
- testString: 'assert(code.match(/header\s.profile-name\s*{\s*?.*?\s*?.*?\s*?\s*?.*?\s*?justify-content\s*:\s*(center|flex-start|flex-end|space-between|space-around)\s*;/g), ''.profile-name
元素的justify-content
属性可选以下值:center、flex-start、flex-end、space-between、space-around。'');'
+ testString: 'assert(code.match(/header\s.profile-name\s*{\s*?.*?\s*?.*?\s*?\s*?.*?\s*?justify-content\s*:\s*(center|flex-start|flex-end|space-between|space-around|space-evenly)\s*;/g));'
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-order-property-to-rearrange-items.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-order-property-to-rearrange-items.chinese.md
index 3501c9c7ff..638ccbc74b 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-order-property-to-rearrange-items.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-flexbox/use-the-order-property-to-rearrange-items.chinese.md
@@ -23,9 +23,9 @@ localeTitle: 使用 order 属性重新排列项目
```yml
tests:
- text: '#box-1
元素应有order
属性,其值应为 2。'
- testString: assert($('#box-1').css('order') == '2', '#box-1
元素应有order
属性,其值应为 2。');
+ testString: assert($('#box-1').css('order') == '2');
- text: '#box-2
元素应有order
属性,其值应为 1。'
- testString: assert($('#box-2').css('order') == '1', '#box-2
元素应有order
属性,其值应为 1。');
+ testString: assert($('#box-2').css('order') == '1');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/add-columns-with-grid-template-columns.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/add-columns-with-grid-template-columns.chinese.md
index b42a77b6a1..1196d624ac 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/add-columns-with-grid-template-columns.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/add-columns-with-grid-template-columns.chinese.md
@@ -33,7 +33,7 @@ localeTitle: 使用 grid-template-columns 添加多列
```yml
tests:
- text: 'container
类应该有grid-template-columns
属性,该属性有三个值,均为100px
。'
- testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?100px\s*?100px\s*?100px\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?100px\s*?100px\s*?100px\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/add-gaps-faster-with-grid-gap.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/add-gaps-faster-with-grid-gap.chinese.md
index 20a8432c7a..acc56b689e 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/add-gaps-faster-with-grid-gap.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/add-gaps-faster-with-grid-gap.chinese.md
@@ -23,7 +23,7 @@ localeTitle: 使用 grid-gap 为网格添加间距
```yml
tests:
- text: 'container
类应该有grid-gap
属性,在行之间设置10px
的间距,在列之间设置20px
的间距。'
- testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-gap\s*?:\s*?10px\s*?20px\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.container\s*?{[\s\S]*grid-gap\s*?:\s*?10px\s+?20px\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/add-rows-with-grid-template-rows.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/add-rows-with-grid-template-rows.chinese.md
index dc8668e62f..5df6f99093 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/add-rows-with-grid-template-rows.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/add-rows-with-grid-template-rows.chinese.md
@@ -23,7 +23,7 @@ localeTitle: 使用 grid-template-rows 添加多行
```yml
tests:
- text: 'container
类应该有grid-template-rows
属性,且该属性的两个值均为50px
'
- testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-rows\s*?:\s*?50px\s*?50px\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.container\s*?{[\s\S]*grid-template-rows\s*?:\s*?50px\s*?50px\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/align-all-items-horizontally-using-justify-items.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/align-all-items-horizontally-using-justify-items.chinese.md
index 5310684a8c..4a2121f060 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/align-all-items-horizontally-using-justify-items.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/align-all-items-horizontally-using-justify-items.chinese.md
@@ -23,7 +23,7 @@ localeTitle: 使用 justify-items 水平对齐所有项目
```yml
tests:
- text: 'container
类应该有justify-items
属性且值为center
。'
- testString: 'assert(code.match(/.container\s*?{[\s\S]*justify-items\s*?:\s*?center\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.container\s*?{[\s\S]*justify-items\s*?:\s*?center\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/align-all-items-vertically-using-align-items.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/align-all-items-vertically-using-align-items.chinese.md
index 39b3c2ceea..77377033c3 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/align-all-items-vertically-using-align-items.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/align-all-items-vertically-using-align-items.chinese.md
@@ -23,7 +23,7 @@ localeTitle: 使用 align-items 垂直对齐所有项目
```yml
tests:
- text: 'container
类应该有align-items
属性且值为end
。'
- testString: 'assert(code.match(/.container\s*?{[\s\S]*align-items\s*?:\s*?end\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.container\s*?{[\s\S]*align-items\s*?:\s*?end\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/align-an-item-horizontally-using-justify-self.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/align-an-item-horizontally-using-justify-self.chinese.md
index ba176009bb..75aca3a9d5 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/align-an-item-horizontally-using-justify-self.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/align-an-item-horizontally-using-justify-self.chinese.md
@@ -26,7 +26,7 @@ localeTitle: 使用 justify-self 水平对齐项目
```yml
tests:
- text: 'item2
类应该有justify-self
属性且值为center
。'
- testString: 'assert(code.match(/.item2\s*?{[\s\S]*justify-self\s*?:\s*?center\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.item2\s*?{[\s\S]*justify-self\s*?:\s*?center\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/align-an-item-vertically-using-align-self.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/align-an-item-vertically-using-align-self.chinese.md
index bf8dd506ec..4b172a5b1c 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/align-an-item-vertically-using-align-self.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/align-an-item-vertically-using-align-self.chinese.md
@@ -23,7 +23,7 @@ localeTitle: 使用 align-self 垂直对齐项目
```yml
tests:
- text: 'item3
类应该有align-self
属性且值为end
。'
- testString: 'assert(code.match(/.item3\s*?{[\s\S]*align-self\s*?:\s*?end\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.item3\s*?{[\s\S]*align-self\s*?:\s*?end\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-a-column-gap-using-grid-column-gap.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-a-column-gap-using-grid-column-gap.chinese.md
index b5d525c99a..fbad4b2eb5 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-a-column-gap-using-grid-column-gap.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-a-column-gap-using-grid-column-gap.chinese.md
@@ -30,7 +30,7 @@ grid-column-gap: 10px;
```yml
tests:
- text: 'container
类应该有grid-column-gap
属性且值为20px
。'
- testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-column-gap\s*?:\s*?20px\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.container\s*?{[\s\S]*grid-column-gap\s*?:\s*?20px\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-a-row-gap-using-grid-row-gap.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-a-row-gap-using-grid-row-gap.chinese.md
index f7717c5261..e51ac66076 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-a-row-gap-using-grid-row-gap.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-a-row-gap-using-grid-row-gap.chinese.md
@@ -23,7 +23,7 @@ localeTitle: 使用 grid-row-gap 创建多行之间的间距
```yml
tests:
- text: 'container
类应该有grid-row-gap
属性且值为5px
。'
- testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-row-gap\s*?:\s*?5px\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.container\s*?{[\s\S]*grid-row-gap\s*?:\s*?5px\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-flexible-layouts-using-auto-fill.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-flexible-layouts-using-auto-fill.chinese.md
index d47b285196..ac590ee71f 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-flexible-layouts-using-auto-fill.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-flexible-layouts-using-auto-fill.chinese.md
@@ -31,7 +31,7 @@ repeat(auto-fill, minmax(60px, 1fr));
```yml
tests:
- text: 'container
类应该有grid-template-columns
属性且使用repeat
和auto-fill
,以便将最小宽度为60px
,最大宽度为1fr
的列填充至网格。'
- testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?auto-fill\s*?,\s*?minmax\s*?\(\s*?60px\s*?,\s*?1fr\s*?\)\s*?\)\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?auto-fill\s*?,\s*?minmax\s*?\(\s*?60px\s*?,\s*?1fr\s*?\)\s*?\)\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-flexible-layouts-using-auto-fit.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-flexible-layouts-using-auto-fit.chinese.md
index aebf7100c7..161c1f21b5 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-flexible-layouts-using-auto-fit.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-flexible-layouts-using-auto-fit.chinese.md
@@ -24,7 +24,7 @@ localeTitle: 使用 auto-fit 创建弹性布局
```yml
tests:
- text: 'container2
类应该有grid-template-columns
属性,且使用repeat
和auto-fit
以便将最小宽度为60px
,最大宽度为1fr
的列放入网格。'
- testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?auto-fit\s*?,\s*?minmax\s*?\(\s*?60px\s*?,\s*?1fr\s*?\)\s*?\)\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.container2\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?auto-fit\s*?,\s*?minmax\s*?\(\s*?60px\s*?,\s*?1fr\s*?\)\s*?\)\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-grids-within-grids.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-grids-within-grids.chinese.md
index aa404e5cf3..083bc0f912 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-grids-within-grids.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-grids-within-grids.chinese.md
@@ -24,9 +24,9 @@ localeTitle: 在网格中创建网格
```yml
tests:
- text: 'item3
类应该有grid-template-columns
属性且值为auto
和1fr
。'
- testString: 'assert(code.match(/.item3\s*?{[\s\S]*grid-template-columns\s*?:\s*?auto\s*?1fr\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.item3\s*?{[\s\S]*grid-template-columns\s*?:\s*?auto\s*?1fr\s*?;[\s\S]*}/gi));
- text: 'item3
类有display
属性且值为grid
。'
- testString: 'assert(code.match(/.item3\s*?{[\s\S]*display\s*?:\s*?grid\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.item3\s*?{[\s\S]*display\s*?:\s*?grid\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-your-first-css-grid.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-your-first-css-grid.chinese.md
index 74ab26ffeb..59c8dc7cd9 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-your-first-css-grid.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/create-your-first-css-grid.chinese.md
@@ -24,7 +24,7 @@ localeTitle: 创建你的第一个 CSS 网格
```yml
tests:
- text: 'container
类应该有display
属性且值为grid
。'
- testString: 'assert(code.match(/.container\s*?{[\s\S]*display\s*?:\s*?grid\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.container\s*?{[\s\S]*display\s*?:\s*?grid\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/divide-the-grid-into-an-area-template.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/divide-the-grid-into-an-area-template.chinese.md
index 62badce525..86a2a9d17a 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/divide-the-grid-into-an-area-template.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/divide-the-grid-into-an-area-template.chinese.md
@@ -34,7 +34,7 @@ grid-template-areas:
```yml
tests:
- text: 'container
类应该有类似于最右侧预览区的grid-template-areas
属性且用.
代替advert
。'
- testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-areas\s*?:\s*?"\s*?header\s*?header\s*?header\s*?"\s*?"\s*?.\s*?content\s*?content\s*?"\s*?"\s*?footer\s*?footer\s*?footer\s*?"\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.container\s*?{[\s\S]*grid-template-areas\s*?:\s*?"\s*?header\s*?header\s*?header\s*?"\s*?"\s*?.\s*?content\s*?content\s*?"\s*?"\s*?footer\s*?footer\s*?footer\s*?"\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/limit-item-size-using-the-minmax-function.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/limit-item-size-using-the-minmax-function.chinese.md
index 3409b16bea..2b8149c1cc 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/limit-item-size-using-the-minmax-function.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/limit-item-size-using-the-minmax-function.chinese.md
@@ -29,7 +29,7 @@ grid-template-columns: 100px minmax(50px, 200px);
```yml
tests:
- text: 'container
类应该有grid-template-columns
属性且设置重复 3 列,每列宽度最小值为90px
,最大值为1fr
。'
- testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?3\s*?,\s*?minmax\s*?\(\s*?90px\s*?,\s*?1fr\s*?\)\s*?\)\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?3\s*?,\s*?minmax\s*?\(\s*?90px\s*?,\s*?1fr\s*?\)\s*?\)\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/place-items-in-grid-areas-using-the-grid-area-property.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/place-items-in-grid-areas-using-the-grid-area-property.chinese.md
index f40a4f2b70..4ee5985df3 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/place-items-in-grid-areas-using-the-grid-area-property.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/place-items-in-grid-areas-using-the-grid-area-property.chinese.md
@@ -31,7 +31,7 @@ localeTitle: 使用 grid-area 属性将项目放置在网格区域中
```yml
tests:
- text: 'item5
类应该有grid-area
属性且值为footer
。'
- testString: 'assert(code.match(/.item5\s*?{[\s\S]*grid-area\s*?:\s*?footer\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.item5\s*?{[\s\S]*grid-area\s*?:\s*?footer\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/reduce-repetition-using-the-repeat-function.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/reduce-repetition-using-the-repeat-function.chinese.md
index cfbd02ad4c..d04c16306d 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/reduce-repetition-using-the-repeat-function.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/reduce-repetition-using-the-repeat-function.chinese.md
@@ -43,7 +43,7 @@ grid-template-columns: 1fr 50px 1fr 50px 20px;
```yml
tests:
- text: 'container
类应该带有grid-template-columns
属性且设置为重复 3 列,宽为1fr
。'
- testString: 'assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?3\s*?,\s*?1fr\s*?\)\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?repeat\s*?\(\s*?3\s*?,\s*?1fr\s*?\)\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/use-grid-area-without-creating-an-areas-template.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/use-grid-area-without-creating-an-areas-template.chinese.md
index 8d051d0248..21135be4c4 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/use-grid-area-without-creating-an-areas-template.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/use-grid-area-without-creating-an-areas-template.chinese.md
@@ -35,7 +35,7 @@ grid-area: horizontal line to start at / vertical line to start at / horizontal
```yml
tests:
- text: 'item5
类应该有grid-area
属性且值为3/1/4/4
。'
- testString: 'assert(code.match(/.item5\s*?{[\s\S]*grid-area\s*?:\s*?3\s*?\/\s*?1\s*?\/\s*?4\s*?\/\s*?4\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/.item5\s*?{[\s\S]*grid-area\s*?:\s*?3\s*?\/\s*?1\s*?\/\s*?4\s*?\/\s*?4\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/use-grid-column-to-control-spacing.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/use-grid-column-to-control-spacing.chinese.md
index 2703073f7f..c495f53389 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/use-grid-column-to-control-spacing.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/use-grid-column-to-control-spacing.chinese.md
@@ -34,7 +34,7 @@ grid-column: 1 / 3;
```yml
tests:
- text: 'item5
类应该有grid-column
属性且其值为2 / 4
。'
- testString: 'assert(code.match(/.item5\s*?{[\s\S]*grid-column\s*?:\s*?2\s*?\/\s*?4\s*?;[\s\S]*}/gi));'
+ testString: assert($('style').text().replace(/\s/g, '').match(/\.item5{.*grid-column:.*}/g));
- text: 'item5
类应该有 grid-column
属性使其占用网格最后两列。'
testString: "
const colStart = getComputedStyle($('.item5')[0]).gridColumnStart;
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/use-grid-row-to-control-spacing.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/use-grid-row-to-control-spacing.chinese.md
index 74eb995de5..c03621c875 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/use-grid-row-to-control-spacing.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/use-grid-row-to-control-spacing.chinese.md
@@ -23,7 +23,7 @@ localeTitle: 使用 grid-row 来控制空间大小
```yml
tests:
- text: 'item5
类应该有grid-row
属性且值为2 / 4
。'
- testString: 'assert(code.match(/.item5\s*?{[\s\S]*grid-row\s*?:\s*?2\s*?\/\s*?4\s*?;[\s\S]*}/gi));'
+ testString: assert($('style').text().replace(/\s/g, '').match(/\.item5{.*grid-row:.*}/g));
- text: 'item5
class 应该有 grid-row
属性使其占用网格最后两行。'
testString: "
const rowStart = getComputedStyle($('.item5')[0]).gridRowStart;
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/use-media-queries-to-create-responsive-layouts.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/use-media-queries-to-create-responsive-layouts.chinese.md
index b94174ea9a..765ae47295 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/css-grid/use-media-queries-to-create-responsive-layouts.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/css-grid/use-media-queries-to-create-responsive-layouts.chinese.md
@@ -24,7 +24,7 @@ localeTitle: 使用媒体查询创建响应式布局
```yml
tests:
- text: '当网页可视区域的宽在400px
及以上时,container
类应该带有grid-template-areas
属性且能够使得 footer 和 header 区域分别占据顶行和底行,advert 和 content 区域分别占据中间行的左和右列。'
- testString: 'assert(code.match(/@media\s*?\(\s*?min-width\s*?:\s*?400px\s*?\)[\s\S]*.container\s*?{[\s\S]*grid-template-areas\s*?:\s*?"\s*?header\s*?header\s*?"\s*?"\s*?advert\s*?content\s*?"\s*?"\s*?footer\s*?footer\s*?"\s*?;[\s\S]*}/gi));'
+ testString: assert(code.match(/@media\s*?\(\s*?min-width\s*?:\s*?400px\s*?\)[\s\S]*.container\s*?{[\s\S]*grid-template-areas\s*?:\s*?"\s*?header\s*?header\s*?"\s*?"\s*?advert\s*?content\s*?"\s*?"\s*?footer\s*?footer\s*?"\s*?;[\s\S]*}/gi));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-principles/make-an-image-responsive.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-principles/make-an-image-responsive.chinese.md
index 467dbe6363..b323276918 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-principles/make-an-image-responsive.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-principles/make-an-image-responsive.chinese.md
@@ -29,11 +29,11 @@ localeTitle: 使图片根据设备尺寸自如响应
```yml
tests:
- text: 'img
标签应设置 max-width
为 100%。'
- testString: 'assert(code.match(/max-width:\s*?100%;/g), ''img
标签应设置 max-width
为 100%。'');'
+ testString: assert(code.match(/max-width:\s*?100%;/g));
- text: 'img
标签应设置 display
为 block。'
- testString: assert($('img').css('display') == 'block', 'img
标签应设置 display
为 block。');
+ testString: assert($('img').css('display') == 'block');
- text: 'img
标签应设置 height
为 auto。'
- testString: 'assert(code.match(/height:\s*?auto;/g), ''img
标签应设置 height
为 auto。'');'
+ testString: assert(code.match(/height:\s*?auto;/g));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-principles/make-typography-responsive.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-principles/make-typography-responsive.chinese.md
index 41669dac59..effb356de4 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-principles/make-typography-responsive.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-principles/make-typography-responsive.chinese.md
@@ -28,9 +28,9 @@ localeTitle: 使排版根据设备尺寸自如响应
```yml
tests:
- text: 'h2
标签 width
应为 80vw。'
- testString: 'assert(code.match(/h2\s*?{\s*?width:\s*?80vw;\s*?}/g), ''h2
标签的 width
应为 80vw。'');'
+ testString: assert(code.match(/h2\s*?{\s*?width:\s*?80vw;\s*?}/g));
- text: 'p
标签 width
应为 75vmin。'
- testString: 'assert(code.match(/p\s*?{\s*?width:\s*?75vmin;\s*?}/g), ''p
标签的 width
应为 75vmin。'');'
+ testString: assert(code.match(/p\s*?{\s*?width:\s*?75vmin;\s*?}/g));
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-principles/use-a-retina-image-for-higher-resolution-displays.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-principles/use-a-retina-image-for-higher-resolution-displays.chinese.md
index 8434b1c645..65602dee59 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-principles/use-a-retina-image-for-higher-resolution-displays.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-principles/use-a-retina-image-for-higher-resolution-displays.chinese.md
@@ -34,9 +34,9 @@ localeTitle: 针对高分辨率屏幕应使用视网膜图片
```yml
tests:
- text: 'img
标签的 width
值应为 100px。'
- testString: assert($('img').css('width') == '100px', 'img
标签的 width
值应为 100px。');
+ testString: assert($('img').css('width') == '100px');
- text: 'img
标签的 height
值应为 100px。'
- testString: assert($('img').css('height') == '100px', 'img
标签的 height
值应为 100px。');
+ testString: assert($('img').css('height') == '100px');
```
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-personal-portfolio-webpage.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-personal-portfolio-webpage.chinese.md
index 1309cc4d8f..a19d262213 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-personal-portfolio-webpage.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-personal-portfolio-webpage.chinese.md
@@ -4,7 +4,7 @@ title: Build a Personal Portfolio Webpage
isRequired: true
challengeType: 3
forumTopicId: 301143
-localTitle: 制作一个个人作品集网页
+localeTitle: 制作一个个人作品集网页
---
## Description
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.chinese.md
index 619713fcf2..fa5d3367b2 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-product-landing-page.chinese.md
@@ -4,7 +4,7 @@ title: Build a Product Landing Page
isRequired: true
challengeType: 3
forumTopicId: 301144
-localTitle: 制作一个产品登录页
+localeTitle: 制作一个产品登录页
---
## Description
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-survey-form.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-survey-form.chinese.md
index 74e1737485..1862ea4ec7 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-survey-form.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-survey-form.chinese.md
@@ -4,7 +4,7 @@ title: Build a Survey Form
isRequired: true
challengeType: 3
forumTopicId: 301145
-localTitle: 制作一个调查表格
+localeTitle: 制作一个调查表格
---
## Description
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.chinese.md
index 579a116eef..52c83a54f9 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-technical-documentation-page.chinese.md
@@ -4,7 +4,7 @@ title: Build a Technical Documentation Page
isRequired: true
challengeType: 3
forumTopicId: 301146
-localTitle: 制作一个技术文档页面
+localeTitle: 制作一个技术文档页面
---
## Description
diff --git a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-tribute-page.chinese.md b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-tribute-page.chinese.md
index 1ff4db9cf8..8154f61137 100644
--- a/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-tribute-page.chinese.md
+++ b/curriculum/challenges/chinese/01-responsive-web-design/responsive-web-design-projects/build-a-tribute-page.chinese.md
@@ -4,7 +4,7 @@ title: Build a Tribute Page
isRequired: true
challengeType: 3
forumTopicId: 301147
-localTitle: 制作一个致敬页
+localeTitle: 制作一个致敬页
---
## Description
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/boo-who.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/boo-who.chinese.md
index 8a5c6f31eb..ce5bdb672f 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/boo-who.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/boo-who.chinese.md
@@ -20,25 +20,25 @@ localeTitle: 嘘谁
```yml
tests:
- text: booWho(true)
应该返回true。
- testString: 'assert.strictEqual(booWho(true), true, "booWho(true)
should return true.");'
+ testString: assert.strictEqual(booWho(true), true);
- text: booWho(false)
应该返回true。
- testString: 'assert.strictEqual(booWho(false), true, "booWho(false)
should return true.");'
+ testString: assert.strictEqual(booWho(false), true);
- text: 'booWho([1, 2, 3])
应该返回false。'
- testString: 'assert.strictEqual(booWho([1, 2, 3]), false, "booWho([1, 2, 3])
should return false.");'
+ testString: assert.strictEqual(booWho([1, 2, 3]), false);
- text: 'booWho([].slice)
应该返回false。'
- testString: 'assert.strictEqual(booWho([].slice), false, "booWho([].slice)
should return false.");'
+ testString: assert.strictEqual(booWho([].slice), false);
- text: 'booWho({ "a": 1 })
应该返回false。'
- testString: 'assert.strictEqual(booWho({ "a": 1 }), false, "booWho({ "a": 1 })
should return false.");'
+ testString: 'assert.strictEqual(booWho({ "a": 1 }), false);'
- text: booWho(1)
应该返回false。
- testString: 'assert.strictEqual(booWho(1), false, "booWho(1)
should return false.");'
+ testString: assert.strictEqual(booWho(1), false);
- text: booWho(NaN)
应该返回false。
- testString: 'assert.strictEqual(booWho(NaN), false, "booWho(NaN)
should return false.");'
+ testString: assert.strictEqual(booWho(NaN), false);
- text: booWho("a")
应该返回false。
- testString: 'assert.strictEqual(booWho("a"), false, "booWho("a")
should return false.");'
+ testString: assert.strictEqual(booWho("a"), false);
- text: booWho("true")
应该返回false。
- testString: 'assert.strictEqual(booWho("true"), false, "booWho("true")
should return false.");'
+ testString: assert.strictEqual(booWho("true"), false);
- text: booWho("false")
应该返回false。
- testString: 'assert.strictEqual(booWho("false"), false, "booWho("false")
should return false.");'
+ testString: assert.strictEqual(booWho("false"), false);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/chunky-monkey.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/chunky-monkey.chinese.md
index a28d321a2f..f22fd9231b 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/chunky-monkey.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/chunky-monkey.chinese.md
@@ -20,19 +20,19 @@ localeTitle: 矮胖的猴子
```yml
tests:
- text: 'chunkArrayInGroups(["a", "b", "c", "d"], 2)
应返回[["a", "b"], ["c", "d"]]
。'
- testString: 'assert.deepEqual(chunkArrayInGroups(["a", "b", "c", "d"], 2), [["a", "b"], ["c", "d"]], "chunkArrayInGroups(["a", "b", "c", "d"], 2)
should return [["a", "b"], ["c", "d"]]
.");'
+ testString: assert.deepEqual(chunkArrayInGroups(["a", "b", "c", "d"], 2), [["a", "b"], ["c", "d"]]);
- text: 'chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3)
应返回[[0, 1, 2], [3, 4, 5]]
。'
- testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]], "chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3)
should return [[0, 1, 2], [3, 4, 5]]
.");'
+ testString: assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]]);
- text: 'chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2)
应返回[[0, 1], [2, 3], [4, 5]]
。'
- testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2), [[0, 1], [2, 3], [4, 5]], "chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2)
should return [[0, 1], [2, 3], [4, 5]]
.");'
+ testString: assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2), [[0, 1], [2, 3], [4, 5]]);
- text: 'chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4)
应该返回[[0, 1, 2, 3], [4, 5]]
。'
- testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], "chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4)
should return [[0, 1, 2, 3], [4, 5]]
.");'
+ testString: assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]]);
- text: 'chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3)
应该返回[[0, 1, 2], [3, 4, 5], [6]]
。'
- testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3), [[0, 1, 2], [3, 4, 5], [6]], "chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3)
should return [[0, 1, 2], [3, 4, 5], [6]]
.");'
+ testString: assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3), [[0, 1, 2], [3, 4, 5], [6]]);
- text: 'chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4)
应返回[[0, 1, 2, 3], [4, 5, 6, 7], [8]]
chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4)
[[0, 1, 2, 3], [4, 5, 6, 7], [8]]
。'
- testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4), [[0, 1, 2, 3], [4, 5, 6, 7], [8]], "chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4)
should return [[0, 1, 2, 3], [4, 5, 6, 7], [8]]
.");'
+ testString: assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4), [[0, 1, 2, 3], [4, 5, 6, 7], [8]]);
- text: 'chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2)
应返回[[0, 1], [2, 3], [4, 5], [6, 7], [8]]
。'
- testString: 'assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2), [[0, 1], [2, 3], [4, 5], [6, 7], [8]], "chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2)
should return [[0, 1], [2, 3], [4, 5], [6, 7], [8]]
.");'
+ testString: assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2), [[0, 1], [2, 3], [4, 5], [6, 7], [8]]);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.chinese.md
index 1033420c1b..961861a6fd 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.chinese.md
@@ -20,27 +20,27 @@ localeTitle: 确认结束
```yml
tests:
- text: 'confirmEnding("Bastian", "n")
应该返回true。'
- testString: 'assert(confirmEnding("Bastian", "n") === true, "confirmEnding("Bastian", "n")
should return true.");'
+ testString: assert(confirmEnding("Bastian", "n") === true);
- text: 'confirmEnding("Congratulation", "on")
应该返回true。'
- testString: 'assert(confirmEnding("Congratulation", "on") === true, "confirmEnding("Congratulation", "on")
should return true.");'
+ testString: assert(confirmEnding("Congratulation", "on") === true);
- text: 'confirmEnding("Connor", "n")
应返回false。'
- testString: 'assert(confirmEnding("Connor", "n") === false, "confirmEnding("Connor", "n")
should return false.");'
+ testString: assert(confirmEnding("Connor", "n") === false);
- text: 'confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification")
应该返回false。'
- testString: 'assert(confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification") === false, "confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification")
should return false.");'
+ testString: assert(confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification") === false);
- text: 'confirmEnding("He has to give me a new name", "name")
应该返回true。'
- testString: 'assert(confirmEnding("He has to give me a new name", "name") === true, "confirmEnding("He has to give me a new name", "name")
should return true.");'
+ testString: assert(confirmEnding("He has to give me a new name", "name") === true);
- text: 'confirmEnding("Open sesame", "same")
应该返回true。'
- testString: 'assert(confirmEnding("Open sesame", "same") === true, "confirmEnding("Open sesame", "same")
should return true.");'
+ testString: assert(confirmEnding("Open sesame", "same") === true);
- text: 'confirmEnding("Open sesame", "pen")
应该返回false。'
- testString: 'assert(confirmEnding("Open sesame", "pen") === false, "confirmEnding("Open sesame", "pen")
should return false.");'
+ testString: assert(confirmEnding("Open sesame", "pen") === false);
- text: 'confirmEnding("Open sesame", "game")
应该返回false。'
- testString: 'assert(confirmEnding("Open sesame", "game") === false, "confirmEnding("Open sesame", "game")
should return false.");'
+ testString: assert(confirmEnding("Open sesame", "game") === false);
- text: 'confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain")
应该返回虚假。'
- testString: 'assert(confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain") === false, "confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain")
should return false.");'
+ testString: assert(confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain") === false);
- text: 'confirmEnding("Abstraction", "action")
应该返回true。'
- testString: 'assert(confirmEnding("Abstraction", "action") === true, "confirmEnding("Abstraction", "action")
should return true.");'
+ testString: assert(confirmEnding("Abstraction", "action") === true);
- text: 不要使用内置方法.endsWith()
来解决挑战。
- testString: 'assert(!(/\.endsWith\(.*?\)\s*?;?/.test(code)) && !(/\["endsWith"\]/.test(code)), "Do not use the built-in method .endsWith()
to solve the challenge.");'
+ testString: assert(!(/\.endsWith\(.*?\)\s*?;?/.test(code)) && !(/\['endsWith'\]/.test(code)));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/convert-celsius-to-fahrenheit.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/convert-celsius-to-fahrenheit.chinese.md
index b1c6281e32..ef0d282aba 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/convert-celsius-to-fahrenheit.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/convert-celsius-to-fahrenheit.chinese.md
@@ -20,17 +20,17 @@ localeTitle: 将摄氏温度转换为华氏温度
```yml
tests:
- text: convertToF(0)
应该返回一个数字
- testString: 'assert(typeof convertToF(0) === "number", "convertToF(0)
should return a number");'
+ testString: assert(typeof convertToF(0) === 'number');
- text: convertToF(-30)
应该返回值-22
- testString: 'assert(convertToF(-30) === -22, "convertToF(-30)
should return a value of -22
");'
+ testString: assert(convertToF(-30) === -22);
- text: convertToF(-10)
应该返回值14
- testString: 'assert(convertToF(-10) === 14, "convertToF(-10)
should return a value of 14
");'
+ testString: assert(convertToF(-10) === 14);
- text: convertToF(0)
应返回值32
- testString: 'assert(convertToF(0) === 32, "convertToF(0)
should return a value of 32
");'
+ testString: assert(convertToF(0) === 32);
- text: convertToF(20)
应返回值68
- testString: 'assert(convertToF(20) === 68, "convertToF(20)
should return a value of 68
");'
+ testString: assert(convertToF(20) === 68);
- text: convertToF(30)
应返回值86
- testString: 'assert(convertToF(30) === 86, "convertToF(30)
should return a value of 86
");'
+ testString: assert(convertToF(30) === 86);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/factorialize-a-number.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/factorialize-a-number.chinese.md
index 9ccf830f3e..f3dc4956eb 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/factorialize-a-number.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/factorialize-a-number.chinese.md
@@ -20,15 +20,15 @@ localeTitle: 对一个数字进行推理
```yml
tests:
- text: factorialize(5)
应该返回一个数字。
- testString: 'assert(typeof factorialize(5) === "number", "factorialize(5)
should return a number.");'
+ testString: assert(typeof factorialize(5) === 'number');
- text: factorialize(5)
应该返回120。
- testString: 'assert(factorialize(5) === 120, "factorialize(5)
should return 120.");'
+ testString: assert(factorialize(5) === 120);
- text: factorialize(10)
应返回3628800。
- testString: 'assert(factorialize(10) === 3628800, "factorialize(10)
should return 3628800.");'
+ testString: assert(factorialize(10) === 3628800);
- text: factorialize(20)
应该返回2432902008176640000。
- testString: 'assert(factorialize(20) === 2432902008176640000, "factorialize(20)
should return 2432902008176640000.");'
+ testString: assert(factorialize(20) === 2432902008176640000);
- text: factorialize(0)
应该返回1。
- testString: 'assert(factorialize(0) === 1, "factorialize(0)
should return 1.");'
+ testString: assert(factorialize(0) === 1);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/falsy-bouncer.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/falsy-bouncer.chinese.md
index a00c73e27b..5fa235387d 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/falsy-bouncer.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/falsy-bouncer.chinese.md
@@ -20,13 +20,13 @@ localeTitle: Falsy Bouncer
```yml
tests:
- text: 'bouncer([7, "ate", "", false, 9])
应该返回[7, "ate", 9]
。'
- testString: 'assert.deepEqual(bouncer([7, "ate", "", false, 9]), [7, "ate", 9], "bouncer([7, "ate", "", false, 9])
should return [7, "ate", 9]
.");'
+ testString: assert.deepEqual(bouncer([7, "ate", "", false, 9]), [7, "ate", 9]);
- text: 'bouncer(["a", "b", "c"])
应返回["a", "b", "c"]
。'
- testString: 'assert.deepEqual(bouncer(["a", "b", "c"]), ["a", "b", "c"], "bouncer(["a", "b", "c"])
should return ["a", "b", "c"]
.");'
+ testString: assert.deepEqual(bouncer(["a", "b", "c"]), ["a", "b", "c"]);
- text: 'bouncer([false, null, 0, NaN, undefined, ""])
应返回[]
。'
- testString: 'assert.deepEqual(bouncer([false, null, 0, NaN, undefined, ""]), [], "bouncer([false, null, 0, NaN, undefined, ""])
should return []
.");'
+ testString: assert.deepEqual(bouncer([false, null, 0, NaN, undefined, ""]), []);
- text: 'bouncer([1, null, NaN, 2, undefined])
应该返回[1, 2]
。'
- testString: 'assert.deepEqual(bouncer([1, null, NaN, 2, undefined]), [1, 2], "bouncer([1, null, NaN, 2, undefined])
should return [1, 2]
.");'
+ testString: assert.deepEqual(bouncer([null, NaN, 1, 2, undefined]), [1, 2]);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/find-the-longest-word-in-a-string.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/find-the-longest-word-in-a-string.chinese.md
index 3f02fddc34..56ae826b0e 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/find-the-longest-word-in-a-string.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/find-the-longest-word-in-a-string.chinese.md
@@ -20,17 +20,17 @@ localeTitle: 找到字符串中最长的单词
```yml
tests:
- text: findLongestWordLength("The quick brown fox jumped over the lazy dog")
应该返回一个数字。
- testString: 'assert(typeof findLongestWordLength("The quick brown fox jumped over the lazy dog") === "number", "findLongestWordLength("The quick brown fox jumped over the lazy dog")
should return a number.");'
+ testString: assert(typeof findLongestWordLength("The quick brown fox jumped over the lazy dog") === "number");
- text: findLongestWordLength("The quick brown fox jumped over the lazy dog")
应该返回6。
- testString: 'assert(findLongestWordLength("The quick brown fox jumped over the lazy dog") === 6, "findLongestWordLength("The quick brown fox jumped over the lazy dog")
should return 6.");'
+ testString: assert(findLongestWordLength("The quick brown fox jumped over the lazy dog") === 6);
- text: findLongestWordLength("May the force be with you")
应该返回5。
- testString: 'assert(findLongestWordLength("May the force be with you") === 5, "findLongestWordLength("May the force be with you")
should return 5.");'
+ testString: assert(findLongestWordLength("May the force be with you") === 5);
- text: findLongestWordLength("Google do a barrel roll")
应返回6。
- testString: 'assert(findLongestWordLength("Google do a barrel roll") === 6, "findLongestWordLength("Google do a barrel roll")
should return 6.");'
+ testString: assert(findLongestWordLength("Google do a barrel roll") === 6);
- text: findLongestWordLength("What is the average airspeed velocity of an unladen swallow")
应该返回8。
- testString: 'assert(findLongestWordLength("What is the average airspeed velocity of an unladen swallow") === 8, "findLongestWordLength("What is the average airspeed velocity of an unladen swallow")
should return 8.");'
+ testString: assert(findLongestWordLength("What is the average airspeed velocity of an unladen swallow") === 8);
- text: findLongestWordLength("What if we try a super-long word such as otorhinolaryngology")
应该返回19。
- testString: 'assert(findLongestWordLength("What if we try a super-long word such as otorhinolaryngology") === 19, "findLongestWordLength("What if we try a super-long word such as otorhinolaryngology")
should return 19.");'
+ testString: assert(findLongestWordLength("What if we try a super-long word such as otorhinolaryngology") === 19);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/finders-keepers.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/finders-keepers.chinese.md
index 88203b5b42..f64cf18725 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/finders-keepers.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/finders-keepers.chinese.md
@@ -20,9 +20,9 @@ localeTitle: Finders Keepers
```yml
tests:
- text: 'findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; })
应该返回8。'
- testString: 'assert.strictEqual(findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; }), 8, "findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; })
should return 8.");'
+ testString: assert.strictEqual(findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; }), 8);
- text: 'findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; })
应返回undefined。'
- testString: 'assert.strictEqual(findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; }), undefined, "findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; })
should return undefined.");'
+ testString: assert.strictEqual(findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; }), undefined);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations.chinese.md
index 0ac68221c1..1f5c8ddd1c 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations.chinese.md
@@ -20,23 +20,23 @@ localeTitle: 突变
```yml
tests:
- text: 'mutation(["hello", "hey"])
应该返回false。'
- testString: 'assert(mutation(["hello", "hey"]) === false, "mutation(["hello", "hey"])
should return false.");'
+ testString: assert(mutation(["hello", "hey"]) === false);
- text: 'mutation(["hello", "Hello"])
应该返回true。'
- testString: 'assert(mutation(["hello", "Hello"]) === true, "mutation(["hello", "Hello"])
should return true.");'
+ testString: assert(mutation(["hello", "Hello"]) === true);
- text: 'mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"])
应该返回true。'
- testString: 'assert(mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"]) === true, "mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"])
should return true.");'
+ testString: assert(mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"]) === true);
- text: 'mutation(["Mary", "Army"])
应该返回true。'
- testString: 'assert(mutation(["Mary", "Army"]) === true, "mutation(["Mary", "Army"])
should return true.");'
+ testString: assert(mutation(["Mary", "Army"]) === true);
- text: 'mutation(["Mary", "Aarmy"])
应该返回true。'
- testString: 'assert(mutation(["Mary", "Aarmy"]) === true, "mutation(["Mary", "Aarmy"])
should return true.");'
+ testString: assert(mutation(["Mary", "Aarmy"]) === true);
- text: 'mutation(["Alien", "line"])
应该返回true。'
- testString: 'assert(mutation(["Alien", "line"]) === true, "mutation(["Alien", "line"])
should return true.");'
+ testString: assert(mutation(["Alien", "line"]) === true);
- text: 'mutation(["floor", "for"])
应该返回true。'
- testString: 'assert(mutation(["floor", "for"]) === true, "mutation(["floor", "for"])
should return true.");'
+ testString: assert(mutation(["floor", "for"]) === true);
- text: 'mutation(["hello", "neo"])
应该返回false。'
- testString: 'assert(mutation(["hello", "neo"]) === false, "mutation(["hello", "neo"])
should return false.");'
+ testString: assert(mutation(["hello", "neo"]) === false);
- text: 'mutation(["voodoo", "no"])
应该返回false。'
- testString: 'assert(mutation(["voodoo", "no"]) === false, "mutation(["voodoo", "no"])
should return false.");'
+ testString: assert(mutation(["voodoo", "no"]) === false);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.chinese.md
index 9af684d397..e617fdf78a 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.chinese.md
@@ -20,19 +20,19 @@ localeTitle: 重复一个字符串重复字符串
```yml
tests:
- text: 'repeatStringNumTimes("*", 3)
应该返回"***"
。'
- testString: 'assert(repeatStringNumTimes("*", 3) === "***", "repeatStringNumTimes("*", 3)
should return "***"
.");'
+ testString: assert(repeatStringNumTimes("*", 3) === "***");
- text: 'repeatStringNumTimes("abc", 3)
应该返回"abcabcabc"
。'
- testString: 'assert(repeatStringNumTimes("abc", 3) === "abcabcabc", "repeatStringNumTimes("abc", 3)
should return "abcabcabc"
.");'
+ testString: assert(repeatStringNumTimes("abc", 3) === "abcabcabc");
- text: 'repeatStringNumTimes("abc", 4)
应返回"abcabcabcabc"
。'
- testString: 'assert(repeatStringNumTimes("abc", 4) === "abcabcabcabc", "repeatStringNumTimes("abc", 4)
should return "abcabcabcabc"
.");'
+ testString: assert(repeatStringNumTimes("abc", 4) === "abcabcabcabc");
- text: 'repeatStringNumTimes("abc", 1)
应该返回"abc"
。'
- testString: 'assert(repeatStringNumTimes("abc", 1) === "abc", "repeatStringNumTimes("abc", 1)
should return "abc"
.");'
+ testString: assert(repeatStringNumTimes("abc", 1) === "abc");
- text: 'repeatStringNumTimes("*", 8)
应该返回"********"
。'
- testString: 'assert(repeatStringNumTimes("*", 8) === "********", "repeatStringNumTimes("*", 8)
should return "********"
.");'
+ testString: assert(repeatStringNumTimes("*", 8) === "********");
- text: 'repeatStringNumTimes("abc", -2)
应返回""
。'
- testString: 'assert(repeatStringNumTimes("abc", -2) === "", "repeatStringNumTimes("abc", -2)
should return ""
.");'
+ testString: assert(repeatStringNumTimes("abc", -2) === "");
- text: 不应使用内置的repeat()
方法
- testString: 'assert(!/\.repeat/g.test(code), "The built-in repeat()
-method should not be used");'
+ testString: assert(!/\.repeat/g.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/return-largest-numbers-in-arrays.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/return-largest-numbers-in-arrays.chinese.md
index 98b25660bb..ba1cbdb3a3 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/return-largest-numbers-in-arrays.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/return-largest-numbers-in-arrays.chinese.md
@@ -20,13 +20,13 @@ localeTitle: 返回数组中的最大数字
```yml
tests:
- text: 'largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])
应该返回一个数组。'
- testString: 'assert(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]).constructor === Array, "largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])
should return an array.");'
+ testString: assert(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]).constructor === Array);
- text: 'largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])
应该返回[27, 5, 39, 1001]
largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])
[27, 5, 39, 1001]
。'
- testString: 'assert.deepEqual(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]), [27, 5, 39, 1001], "largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])
should return [27, 5, 39, 1001]
.");'
+ testString: assert.deepEqual(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]), [27, 5, 39, 1001]);
- text: 'largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]])
应该返回[9, 35, 97, 1000000]
largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]])
[9, 35, 97, 1000000]
。'
- testString: 'assert.deepEqual(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]), [9, 35, 97, 1000000], "largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]])
should return [9, 35, 97, 1000000]
.");'
+ testString: assert.deepEqual(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]), [9, 35, 97, 1000000]);
- text: 'largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]])
应该返回[25, 48, 21, -3]
。'
- testString: 'assert.deepEqual(largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]]), [25, 48, 21, -3], "largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]])
should return [25, 48, 21, -3]
.");'
+ testString: assert.deepEqual(largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]]), [25, 48, 21, -3]);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string.chinese.md
index 45c5c8f47a..c80edce4b3 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string.chinese.md
@@ -20,13 +20,13 @@ localeTitle: 反转字符串
```yml
tests:
- text: reverseString("hello")
应该返回一个字符串。
- testString: 'assert(typeof reverseString("hello") === "string", "reverseString("hello")
should return a string.");'
+ testString: assert(typeof reverseString("hello") === "string");
- text: reverseString("hello")
应该变成"olleh"
。
- testString: 'assert(reverseString("hello") === "olleh", "reverseString("hello")
should become "olleh"
.");'
+ testString: assert(reverseString("hello") === "olleh");
- text: reverseString("Howdy")
应该变成"ydwoH"
。
- testString: 'assert(reverseString("Howdy") === "ydwoH", "reverseString("Howdy")
should become "ydwoH"
.");'
+ testString: assert(reverseString("Howdy") === "ydwoH");
- text: reverseString("Greetings from Earth")
应返回"htraE morf sgniteerG"
。
- testString: 'assert(reverseString("Greetings from Earth") === "htraE morf sgniteerG", "reverseString("Greetings from Earth")
should return "htraE morf sgniteerG"
.");'
+ testString: assert(reverseString("Greetings from Earth") === "htraE morf sgniteerG");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice.chinese.md
index 7e8b69d02a..0de218324e 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice.chinese.md
@@ -21,17 +21,17 @@ localeTitle: 切片和拼接
```yml
tests:
- text: 'frankenSplice([1, 2, 3], [4, 5], 1)
应该返回[4, 1, 2, 3, 5]
frankenSplice([1, 2, 3], [4, 5], 1)
[4, 1, 2, 3, 5]
。'
- testString: 'assert.deepEqual(frankenSplice([1, 2, 3], [4, 5], 1), [4, 1, 2, 3, 5], "frankenSplice([1, 2, 3], [4, 5], 1)
should return [4, 1, 2, 3, 5]
.");'
+ testString: assert.deepEqual(frankenSplice([1, 2, 3], [4, 5], 1), [4, 1, 2, 3, 5]);
- text: 'frankenSplice([1, 2], ["a", "b"], 1)
应返回["a", 1, 2, "b"]
。'
- testString: 'assert.deepEqual(frankenSplice(testArr1, testArr2, 1), ["a", 1, 2, "b"], "frankenSplice([1, 2], ["a", "b"], 1)
should return ["a", 1, 2, "b"]
.");'
+ testString: assert.deepEqual(frankenSplice(testArr1, testArr2, 1), ["a", 1, 2, "b"]);
- text: 'frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2)
应该返回["head", "shoulders", "claw", "tentacle", "knees", "toes"]
。'
- testString: 'assert.deepEqual(frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2), ["head", "shoulders", "claw", "tentacle", "knees", "toes"], "frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2)
should return ["head", "shoulders", "claw", "tentacle", "knees", "toes"]
.");'
+ testString: assert.deepEqual(frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2), ["head", "shoulders", "claw", "tentacle", "knees", "toes"]);
- text: 第一个数组中的所有元素都应按原始顺序添加到第二个数组中。
- testString: 'assert.deepEqual(frankenSplice([1, 2, 3, 4], [], 0), [1, 2, 3, 4], "All elements from the first array should be added to the second array in their original order.");'
+ testString: assert.deepEqual(frankenSplice([1, 2, 3, 4], [], 0), [1, 2, 3, 4]);
- text: 函数运行后,第一个数组应保持不变。
- testString: 'assert(testArr1[0] === 1 && testArr1[1] === 2, "The first array should remain the same after the function runs.");'
+ testString: assert(testArr1[0] === 1 && testArr1[1] === 2);
- text: 函数运行后,第二个数组应保持不变。
- testString: 'assert(testArr2[0] === "a" && testArr2[1] === "b", "The second array should remain the same after the function runs.");'
+ testString: assert(testArr2[0] === "a" && testArr2[1] === "b");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/title-case-a-sentence.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/title-case-a-sentence.chinese.md
index 54c9b5edb3..7cfc27572e 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/title-case-a-sentence.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/title-case-a-sentence.chinese.md
@@ -20,13 +20,13 @@ localeTitle: 标题案例句子
```yml
tests:
- text: 'titleCase("I'm a little tea pot")
应该返回一个字符串。'
- testString: 'assert(typeof titleCase("I"m a little tea pot") === "string", "titleCase("I'm a little tea pot")
should return a string.");'
+ testString: assert(typeof titleCase("I'm a little tea pot") === "string");
- text: 'titleCase("I'm a little tea pot")
应该归还I'm A Little Tea Pot
。'
- testString: 'assert(titleCase("I"m a little tea pot") === "I"m A Little Tea Pot", "titleCase("I'm a little tea pot")
should return I'm A Little Tea Pot
.");'
+ testString: assert(titleCase("I'm a little tea pot") === "I'm A Little Tea Pot");
- text: titleCase("sHoRt AnD sToUt")
应返回Short And Stout
。
- testString: 'assert(titleCase("sHoRt AnD sToUt") === "Short And Stout", "titleCase("sHoRt AnD sToUt")
should return Short And Stout
.");'
+ testString: assert(titleCase("sHoRt AnD sToUt") === "Short And Stout");
- text: titleCase("HERE IS MY HANDLE HERE IS MY SPOUT")
Here Is My Handle Here Is My Spout
titleCase("HERE IS MY HANDLE HERE IS MY SPOUT")
应该回到Here Is My Handle Here Is My Spout
。
- testString: 'assert(titleCase("HERE IS MY HANDLE HERE IS MY SPOUT") === "Here Is My Handle Here Is My Spout", "titleCase("HERE IS MY HANDLE HERE IS MY SPOUT")
should return Here Is My Handle Here Is My Spout
.");'
+ testString: assert(titleCase("HERE IS MY HANDLE HERE IS MY SPOUT") === "Here Is My Handle Here Is My Spout");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/truncate-a-string.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/truncate-a-string.chinese.md
index dd33ca4acd..559e4a418f 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/truncate-a-string.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/truncate-a-string.chinese.md
@@ -20,17 +20,17 @@ localeTitle: 截断字符串
```yml
tests:
- text: 'truncateString("A-tisket a-tasket A green and yellow basket", 8)
应该返回“A-tisket ......”。'
- testString: 'assert(truncateString("A-tisket a-tasket A green and yellow basket", 8) === "A-tisket...", "truncateString("A-tisket a-tasket A green and yellow basket", 8)
should return "A-tisket...".");'
+ testString: assert(truncateString("A-tisket a-tasket A green and yellow basket", 8) === "A-tisket...");
- text: 'truncateString("Peter Piper picked a peck of pickled peppers", 11)
应该回归“Peter Piper ......”。'
- testString: 'assert(truncateString("Peter Piper picked a peck of pickled peppers", 11) === "Peter Piper...", "truncateString("Peter Piper picked a peck of pickled peppers", 11)
should return "Peter Piper...".");'
+ testString: assert(truncateString("Peter Piper picked a peck of pickled peppers", 11) === "Peter Piper...");
- text: 'truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length)
应该返回“A-tisket a-tasket A green and yellow basket”。'
- testString: 'assert(truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length) === "A-tisket a-tasket A green and yellow basket", "truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length)
should return "A-tisket a-tasket A green and yellow basket".");'
+ testString: assert(truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length) === "A-tisket a-tasket A green and yellow basket");
- text: 'truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length + 2)
应返回“A-tisket a-tasket A green and yellow basket”。'
- testString: 'assert(truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length + 2) === "A-tisket a-tasket A green and yellow basket", "truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length + 2)
should return "A-tisket a-tasket A green and yellow basket".");'
+ testString: assert(truncateString('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length + 2) === 'A-tisket a-tasket A green and yellow basket');
- text: 'truncateString("A-", 1)
应返回“A ...”。'
- testString: 'assert(truncateString("A-", 1) === "A...", "truncateString("A-", 1)
should return "A...".");'
+ testString: assert(truncateString("A-", 1) === "A...");
- text: 'truncateString("Absolutely Longer", 2)
应返回“Ab ...”。'
- testString: 'assert(truncateString("Absolutely Longer", 2) === "Ab...", "truncateString("Absolutely Longer", 2)
should return "Ab...".");'
+ testString: assert(truncateString("Absolutely Longer", 2) === "Ab...");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/where-do-i-belong.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/where-do-i-belong.chinese.md
index 25aa7e96f7..48c8ecb98a 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/where-do-i-belong.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/where-do-i-belong.chinese.md
@@ -20,37 +20,37 @@ localeTitle: 我属于哪里?
```yml
tests:
- text: 'getIndexToIns([10, 20, 30, 40, 50], 35)
应返回3
。'
- testString: 'assert(getIndexToIns([10, 20, 30, 40, 50], 35) === 3, "getIndexToIns([10, 20, 30, 40, 50], 35)
should return 3
.");'
+ testString: assert(getIndexToIns([10, 20, 30, 40, 50], 35) === 3);
- text: 'getIndexToIns([10, 20, 30, 40, 50], 35)
应返回一个数字。'
- testString: 'assert(typeof(getIndexToIns([10, 20, 30, 40, 50], 35)) === "number", "getIndexToIns([10, 20, 30, 40, 50], 35)
should return a number.");'
+ testString: assert(typeof(getIndexToIns([10, 20, 30, 40, 50], 35)) === "number");
- text: 'getIndexToIns([10, 20, 30, 40, 50], 30)
应该返回2
。'
- testString: 'assert(getIndexToIns([10, 20, 30, 40, 50], 30) === 2, "getIndexToIns([10, 20, 30, 40, 50], 30)
should return 2
.");'
+ testString: assert(getIndexToIns([10, 20, 30, 40, 50], 30) === 2);
- text: 'getIndexToIns([10, 20, 30, 40, 50], 30)
应该返回一个数字。'
- testString: 'assert(typeof(getIndexToIns([10, 20, 30, 40, 50], 30)) === "number", "getIndexToIns([10, 20, 30, 40, 50], 30)
should return a number.");'
+ testString: assert(typeof(getIndexToIns([10, 20, 30, 40, 50], 30)) === "number");
- text: 'getIndexToIns([40, 60], 50)
应返回1
。'
- testString: 'assert(getIndexToIns([40, 60], 50) === 1, "getIndexToIns([40, 60], 50)
should return 1
.");'
+ testString: assert(getIndexToIns([40, 60], 50) === 1);
- text: 'getIndexToIns([40, 60], 50)
应返回一个数字。'
- testString: 'assert(typeof(getIndexToIns([40, 60], 50)) === "number", "getIndexToIns([40, 60], 50)
should return a number.");'
+ testString: assert(typeof(getIndexToIns([40, 60], 50)) === "number");
- text: 'getIndexToIns([3, 10, 5], 3)
应该返回0
。'
- testString: 'assert(getIndexToIns([3, 10, 5], 3) === 0, "getIndexToIns([3, 10, 5], 3)
should return 0
.");'
+ testString: assert(getIndexToIns([3, 10, 5], 3) === 0);
- text: 'getIndexToIns([3, 10, 5], 3)
应返回一个数字。'
- testString: 'assert(typeof(getIndexToIns([3, 10, 5], 3)) === "number", "getIndexToIns([3, 10, 5], 3)
should return a number.");'
+ testString: assert(typeof(getIndexToIns([3, 10, 5], 3)) === "number");
- text: 'getIndexToIns([5, 3, 20, 3], 5)
应返回2
。'
- testString: 'assert(getIndexToIns([5, 3, 20, 3], 5) === 2, "getIndexToIns([5, 3, 20, 3], 5)
should return 2
.");'
+ testString: assert(getIndexToIns([5, 3, 20, 3], 5) === 2);
- text: 'getIndexToIns([5, 3, 20, 3], 5)
应返回一个数字。'
- testString: 'assert(typeof(getIndexToIns([5, 3, 20, 3], 5)) === "number", "getIndexToIns([5, 3, 20, 3], 5)
should return a number.");'
+ testString: assert(typeof(getIndexToIns([5, 3, 20, 3], 5)) === "number");
- text: 'getIndexToIns([2, 20, 10], 19)
应该返回2
。'
- testString: 'assert(getIndexToIns([2, 20, 10], 19) === 2, "getIndexToIns([2, 20, 10], 19)
should return 2
.");'
+ testString: assert(getIndexToIns([2, 20, 10], 19) === 2);
- text: 'getIndexToIns([2, 20, 10], 19)
应返回一个数字。'
- testString: 'assert(typeof(getIndexToIns([2, 20, 10], 19)) === "number", "getIndexToIns([2, 20, 10], 19)
should return a number.");'
+ testString: assert(typeof(getIndexToIns([2, 20, 10], 19)) === "number");
- text: 'getIndexToIns([2, 5, 10], 15)
应该返回3
。'
- testString: 'assert(getIndexToIns([2, 5, 10], 15) === 3, "getIndexToIns([2, 5, 10], 15)
should return 3
.");'
+ testString: assert(getIndexToIns([2, 5, 10], 15) === 3);
- text: 'getIndexToIns([2, 5, 10], 15)
应返回一个数字。'
- testString: 'assert(typeof(getIndexToIns([2, 5, 10], 15)) === "number", "getIndexToIns([2, 5, 10], 15)
should return a number.");'
+ testString: assert(typeof(getIndexToIns([2, 5, 10], 15)) === "number");
- text: 'getIndexToIns([], 1)
应该返回0
。'
- testString: 'assert(getIndexToIns([], 1) === 0, "getIndexToIns([], 1)
should return 0
.");'
+ testString: assert(getIndexToIns([], 1) === 0);
- text: 'getIndexToIns([], 1)
应该返回一个数字。'
- testString: 'assert(typeof(getIndexToIns([], 1)) === "number", "getIndexToIns([], 1)
should return a number.");'
+ testString: assert(typeof(getIndexToIns([], 1)) === "number");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/access-an-arrays-contents-using-bracket-notation.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/access-an-arrays-contents-using-bracket-notation.chinese.md
index e01f5fd4dd..5ca7237575 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/access-an-arrays-contents-using-bracket-notation.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/access-an-arrays-contents-using-bracket-notation.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 使用括号表示法访问数组的内容
```yml
tests:
- text: 'myArray[0]
等于"a"
'
- testString: 'assert.strictEqual(myArray[0], "a", "myArray[0]
is equal to "a"
");'
+ testString: assert.strictEqual(myArray[0], "a");
- text: 'myArray[1]
不再设置为"b"
'
- testString: 'assert.notStrictEqual(myArray[1], "b", "myArray[1]
is no longer set to "b"
");'
+ testString: assert.notStrictEqual(myArray[1], "b");
- text: 'myArray[2]
等于"c"
'
- testString: 'assert.strictEqual(myArray[2], "c", "myArray[2]
is equal to "c"
");'
+ testString: assert.strictEqual(myArray[2], "c");
- text: 'myArray[3]
等于"d"
'
- testString: 'assert.strictEqual(myArray[3], "d", "myArray[3]
is equal to "d"
");'
+ testString: assert.strictEqual(myArray[3], "d");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/access-property-names-with-bracket-notation.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/access-property-names-with-bracket-notation.chinese.md
index 76b5254d0d..4023801c79 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/access-property-names-with-bracket-notation.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/access-property-names-with-bracket-notation.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 使用括号表示法访问属性名称
```yml
tests:
- text: checkInventory
是一个函数
- testString: 'assert.strictEqual(typeof checkInventory, "function", "checkInventory
is a function");'
+ testString: assert.strictEqual(typeof checkInventory, 'function');
- text: 'foods
对象应该只有以下键值对: apples: 25
, oranges: 32
, plums: 28
, bananas: 13
, grapes: 35
, strawberries: 27
'
- testString: 'assert.deepEqual(foods, {apples: 25, oranges: 32, plums: 28, bananas: 13, grapes: 35, strawberries: 27}, "The foods
object should have only the following key-value pairs: apples: 25
, oranges: 32
, plums: 28
, bananas: 13
, grapes: 35
, strawberries: 27
");'
+ testString: 'assert.deepEqual(foods, {apples: 25, oranges: 32, plums: 28, bananas: 13, grapes: 35, strawberries: 27});'
- text: checkInventory("apples")
应该返回25
- testString: 'assert.strictEqual(checkInventory("apples"), 25, "checkInventory("apples")
should return 25
");'
+ testString: assert.strictEqual(checkInventory('apples'), 25);
- text: checkInventory("bananas")
应该返回13
- testString: 'assert.strictEqual(checkInventory("bananas"), 13, "checkInventory("bananas")
should return 13
");'
+ testString: assert.strictEqual(checkInventory('bananas'), 13);
- text: checkInventory("strawberries")
应该返回27
- testString: 'assert.strictEqual(checkInventory("strawberries"), 27, "checkInventory("strawberries")
should return 27
");'
+ testString: assert.strictEqual(checkInventory('strawberries'), 27);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-to-an-array-with-push-and-unshift.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-to-an-array-with-push-and-unshift.chinese.md
index 875e5471dc..6f488ee7f1 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-to-an-array-with-push-and-unshift.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-to-an-array-with-push-and-unshift.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 使用push()和unshift()将项添加到数组
```yml
tests:
- text: 'mixedNumbers(["IV", 5, "six"])
现在应该返回["I", 2, "three", "IV", 5, "six", 7, "VIII", 9]
'
- testString: 'assert.deepEqual(mixedNumbers(["IV", 5, "six"]), ["I", 2, "three", "IV", 5, "six", 7, "VIII", 9], "mixedNumbers(["IV", 5, "six"])
should now return ["I", 2, "three", "IV", 5, "six", 7, "VIII", 9]
");'
+ testString: assert.deepEqual(mixedNumbers(['IV', 5, 'six']), ['I', 2, 'three', 'IV', 5, 'six', 7, 'VIII', 9]);
- text: mixedNumbers
函数应该使用push()
方法
- testString: 'assert.notStrictEqual(mixedNumbers.toString().search(/\.push\(/), -1, "The mixedNumbers
function should utilize the push()
method");'
+ testString: assert(mixedNumbers.toString().match(/\.push/));
- text: mixedNumbers
函数应该使用unshift()
方法
- testString: 'assert.notStrictEqual(mixedNumbers.toString().search(/\.unshift\(/), -1, "The mixedNumbers
function should utilize the unshift()
method");'
+ testString: assert(mixedNumbers.toString().match(/\.unshift/));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.chinese.md
index 318a2d86fb..c0f7bca818 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 使用splice()添加项目
```yml
tests:
- text: 'htmlColorNames
应该返回["DarkSalmon", "BlanchedAlmond", "LavenderBlush", "PaleTurqoise", "FireBrick"]
'
- testString: 'assert.deepEqual(htmlColorNames(["DarkGoldenRod", "WhiteSmoke", "LavenderBlush", "PaleTurqoise", "FireBrick"]), ["DarkSalmon", "BlanchedAlmond", "LavenderBlush", "PaleTurqoise", "FireBrick"], "htmlColorNames
should return ["DarkSalmon", "BlanchedAlmond", "LavenderBlush", "PaleTurqoise", "FireBrick"]
");'
+ testString: assert.deepEqual(htmlColorNames(['DarkGoldenRod', 'WhiteSmoke', 'LavenderBlush', 'PaleTurquoise', 'FireBrick']), ['DarkSalmon', 'BlanchedAlmond', 'LavenderBlush', 'PaleTurquoise', 'FireBrick']);
- text: htmlColorNames
函数应该使用splice()
方法
- testString: 'assert(/.splice/.test(code), "The htmlColorNames
function should utilize the splice()
method");'
+ testString: assert(/.splice/.test(code));
- text: 你不应该使用shift()
或unshift()
。
- testString: 'assert(!/shift|unshift/.test(code), "You should not use shift()
or unshift()
.");'
+ testString: assert(!/shift|unshift/.test(code));
- text: 您不应该使用数组括号表示法。
- testString: 'assert(!/\[\d\]\s*=/.test(code), "You should not use array bracket notation.");'
+ testString: assert(!/\[\d\]\s*=/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.chinese.md
index a1ee7dcf76..2e6595a8d5 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 将键值对添加到JavaScript对象
```yml
tests:
- text: foods
是一个对象
- testString: 'assert(typeof foods === "object", "foods
is an object");'
+ testString: assert(typeof foods === 'object');
- text: foods
对象有一个值为13
的关键"bananas"
- testString: 'assert(foods.bananas === 13, "The foods
object has a key "bananas"
with a value of 13
");'
+ testString: assert(foods.bananas === 13);
- text: foods
对象有一个关键的"grapes"
,价值35
- testString: 'assert(foods.grapes === 35, "The foods
object has a key "grapes"
with a value of 35
");'
+ testString: assert(foods.grapes === 35);
- text: foods
对象有一个关键的"strawberries"
,值为27
- testString: 'assert(foods.strawberries === 27, "The foods
object has a key "strawberries"
with a value of 27
");'
+ testString: assert(foods.strawberries === 27);
- text: 应使用点或括号表示法设置键值对
- testString: 'assert(code.search(/bananas:/) === -1 && code.search(/grapes:/) === -1 && code.search(/strawberries:/) === -1, "The key-value pairs should be set using dot or bracket notation");'
+ testString: assert(code.search(/bananas:/) === -1 && code.search(/grapes:/) === -1 && code.search(/strawberries:/) === -1);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-for-the-presence-of-an-element-with-indexof.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-for-the-presence-of-an-element-with-indexof.chinese.md
index f9dac24bbe..1ca7cfa296 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-for-the-presence-of-an-element-with-indexof.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-for-the-presence-of-an-element-with-indexof.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 使用indexOf()检查元素是否存在
```yml
tests:
- text: 'quickCheck(["squash", "onions", "shallots"], "mushrooms")
应该返回false
'
- testString: 'assert.strictEqual(quickCheck(["squash", "onions", "shallots"], "mushrooms"), false, "quickCheck(["squash", "onions", "shallots"], "mushrooms")
should return false
");'
+ testString: assert.strictEqual(quickCheck(['squash', 'onions', 'shallots'], 'mushrooms'), false);
- text: 'quickCheck(["squash", "onions", "shallots"], "onions")
应该返回true
'
- testString: 'assert.strictEqual(quickCheck(["squash", "onions", "shallots"], "onions"), true, "quickCheck(["squash", "onions", "shallots"], "onions")
should return true
");'
+ testString: assert.strictEqual(quickCheck(['onions', 'squash', 'shallots'], 'onions'), true);
- text: 'quickCheck([3, 5, 9, 125, 45, 2], 125)
应该返回true
'
- testString: 'assert.strictEqual(quickCheck([3, 5, 9, 125, 45, 2], 125), true, "quickCheck([3, 5, 9, 125, 45, 2], 125)
should return true
");'
+ testString: assert.strictEqual(quickCheck([3, 5, 9, 125, 45, 2], 125), true);
- text: 'quickCheck([true, false, false], undefined)
应返回false
'
- testString: 'assert.strictEqual(quickCheck([true, false, false], undefined), false, "quickCheck([true, false, false], undefined)
should return false
");'
+ testString: assert.strictEqual(quickCheck([true, false, false], undefined), false);
- text: quickCheck
函数应该使用indexOf()
方法
- testString: 'assert.notStrictEqual(quickCheck.toString().search(/\.indexOf\(/), -1, "The quickCheck
function should utilize the indexOf()
method");'
+ testString: assert.notStrictEqual(quickCheck.toString().search(/\.indexOf\(/), -1);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/combine-arrays-with-the-spread-operator.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/combine-arrays-with-the-spread-operator.chinese.md
index ec13777a3f..ae3cdb7bdd 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/combine-arrays-with-the-spread-operator.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/combine-arrays-with-the-spread-operator.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 将数组与Spread运算符组合在一起
```yml
tests:
- text: 'spreadOut
应该返回["learning", "to", "code", "is", "fun"]
'
- testString: 'assert.deepEqual(spreadOut(), ["learning", "to", "code", "is", "fun"], "spreadOut
should return ["learning", "to", "code", "is", "fun"]
");'
+ testString: assert.deepEqual(spreadOut(), ['learning', 'to', 'code', 'is', 'fun']);
- text: spreadOut
函数应该使用扩展语法
- testString: 'assert.notStrictEqual(spreadOut.toString().search(/[...]/), -1, "The spreadOut
function should utilize spread syntax");'
+ testString: assert.notStrictEqual(spreadOut.toString().search(/[...]/), -1);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.chinese.md
index 3374c55a0b..52170e1f19 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 使用Spread Operator复制数组
```yml
tests:
- text: 'copyMachine([true, false, true], 2)
应返回[[true, false, true], [true, false, true]]
'
- testString: 'assert.deepEqual(copyMachine([true, false, true], 2), [[true, false, true], [true, false, true]], "copyMachine([true, false, true], 2)
should return [[true, false, true], [true, false, true]]
");'
+ testString: assert.deepEqual(copyMachine([true, false, true], 2), [[true, false, true], [true, false, true]]);
- text: 'copyMachine([1, 2, 3], 5)
应返回[[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]]
'
- testString: 'assert.deepEqual(copyMachine([1, 2, 3], 5), [[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]], "copyMachine([1, 2, 3], 5)
should return [[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]]
");'
+ testString: assert.deepEqual(copyMachine([1, 2, 3], 5), [[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]]);
- text: 'copyMachine([true, true, null], 1)
应该返回[[true, true, null]]
'
- testString: 'assert.deepEqual(copyMachine([true, true, null], 1), [[true, true, null]], "copyMachine([true, true, null], 1)
should return [[true, true, null]]
");'
+ testString: assert.deepEqual(copyMachine([true, true, null], 1), [[true, true, null]]);
- text: 'copyMachine(["it works"], 3)
应该返回[["it works"], ["it works"], ["it works"]]
'
- testString: 'assert.deepEqual(copyMachine(["it works"], 3), [["it works"], ["it works"], ["it works"]], "copyMachine(["it works"], 3)
should return [["it works"], ["it works"], ["it works"]]
");'
+ testString: assert.deepEqual(copyMachine(['it works'], 3), [['it works'], ['it works'], ['it works']]);
- text: copyMachine
函数应该使用带有数组arr
的spread operator
- testString: 'assert.notStrictEqual(copyMachine.toString().indexOf(".concat(_toConsumableArray(arr))"), -1, "The copyMachine
function should utilize the spread operator
with array arr
");'
+ testString: assert(removeJSComments(code).match(/\.\.\.arr/));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.chinese.md
index 777fb946e5..8fb9a8db1e 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用slice()复制数组项
```yml
tests:
- text: 'forecast
应该返回["warm", "sunny"]
'
- testString: 'assert.deepEqual(forecast(["cold", "rainy", "warm", "sunny", "cool", "thunderstorms"]), ["warm", "sunny"], "forecast
should return ["warm", "sunny"]");'
+ testString: assert.deepEqual(forecast(['cold', 'rainy', 'warm', 'sunny', 'cool', 'thunderstorms']), ['warm', 'sunny']);
- text:
。
- testString: 'assert($(".btn-info > i").is(".fa.fa-info-circle") || $(".btn-info > span").is(".fa.fa-info-circle"), "You should add a forecast
函数应该使用slice()
方法
- testString: 'assert(/\.slice\(/.test(code), "The forecast
function should utilize the slice()
method");'
+ testString: assert(/\.slice\(/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays.chinese.md
index cd18687c8a..93476ca33c 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/create-complex-multi-dimensional-arrays.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 创建复杂的多维数组
```yml
tests:
- text: myNestedArray
应仅包含数字,布尔值和字符串作为数据元素
- testString: 'assert.strictEqual((function(arr) { let flattened = (function flatten(arr) { const flat = [].concat(...arr); return flat.some (Array.isArray) ? flatten(flat) : flat; })(arr); for (let i = 0; i < flattened.length; i++) { if ( typeof flattened[i] !== "number" && typeof flattened[i] !== "string" && typeof flattened[i] !== "boolean") { return false } } return true })(myNestedArray), true, "myNestedArray
should contain only numbers, booleans, and strings as data elements");'
+ testString: 'assert.strictEqual((function(arr) { let flattened = (function flatten(arr) { const flat = [].concat(...arr); return flat.some (Array.isArray) ? flatten(flat) : flat; })(arr); for (let i = 0; i < flattened.length; i++) { if ( typeof flattened[i] !== ''number'' && typeof flattened[i] !== ''string'' && typeof flattened[i] !== ''boolean'') { return false } } return true })(myNestedArray), true);'
- text: myNestedArray
应该有5个级别的深度
- testString: 'assert.strictEqual((function(arr) {let depth = 0;function arrayDepth(array, i, d) { if (Array.isArray(array[i])) { arrayDepth(array[i], 0, d + 1);} else { depth = (d > depth) ? d : depth;}if (i < array.length) { arrayDepth(array, i + 1, d);} }arrayDepth(arr, 0, 0);return depth;})(myNestedArray), 4, "myNestedArray
should have exactly 5 levels of depth");'
+ testString: 'assert.strictEqual((function(arr) {let depth = 0;function arrayDepth(array, i, d) { if (Array.isArray(array[i])) { arrayDepth(array[i], 0, d + 1);} else { depth = (d > depth) ? d : depth;}if (i < array.length) { arrayDepth(array, i + 1, d);} }arrayDepth(arr, 0, 0);return depth;})(myNestedArray), 4);'
- text: myNestedArray
应该在嵌套3级深度的数组中恰好包含一个字符串"deep"
- testString: 'assert((function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, "deep").length === 1 && (function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, "deep")[0] === 2, "myNestedArray
should contain exactly one occurrence of the string "deep"
on an array nested 3 levels deep");'
+ testString: assert((function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, 'deep').length === 1 && (function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, 'deep')[0] === 2);
- text: myNestedArray
应该在嵌套4级深度的数组中恰好包含一个字符串"deeper"
deep”
- testString: 'assert((function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, "deeper").length === 1 && (function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, "deeper")[0] === 3, "myNestedArray
should contain exactly one occurrence of the string "deeper"
on an array nested 4 levels deep");'
+ testString: assert((function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, 'deeper').length === 1 && (function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, 'deeper')[0] === 3);
- text: myNestedArray
应该在嵌套5级深度的数组中恰好包含一个字符串"deepest"
myNestedArray
"deepest"
- testString: 'assert((function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, "deepest").length === 1 && (function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, "deepest")[0] === 4, "myNestedArray
should contain exactly one occurrence of the string "deepest"
on an array nested 5 levels deep");'
+ testString: assert((function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, 'deepest').length === 1 && (function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, 'deepest')[0] === 4);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/generate-an-array-of-all-object-keys-with-object.keys.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/generate-an-array-of-all-object-keys-with-object.keys.chinese.md
index 2be5dc3007..a9c7ff99af 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/generate-an-array-of-all-object-keys-with-object.keys.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/generate-an-array-of-all-object-keys-with-object.keys.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用Object.keys()生成所有对象键的数组
```yml
tests:
- text: users
对象仅包含Alan
, Jeff
, Sarah
和Ryan
- testString: 'assert("Alan" in users && "Jeff" in users && "Sarah" in users && "Ryan" in users && Object.keys(users).length === 4, "The users
object only contains the keys Alan
, Jeff
, Sarah
, and Ryan
");'
+ testString: assert('Alan' in users && 'Jeff' in users && 'Sarah' in users && 'Ryan' in users && Object.keys(users).length === 4);
- text: getArrayOfUsers
函数返回一个数组,其中包含users
对象中的所有键
- testString: 'assert((function() { users.Sam = {}; users.Lewis = {}; let R = getArrayOfUsers(users); return (R.indexOf("Alan") !== -1 && R.indexOf("Jeff") !== -1 && R.indexOf("Sarah") !== -1 && R.indexOf("Ryan") !== -1 && R.indexOf("Sam") !== -1 && R.indexOf("Lewis") !== -1); })() === true, "The getArrayOfUsers
function returns an array which contains all the keys in the users
object");'
+ testString: assert((function() { users.Sam = {}; users.Lewis = {}; let R = getArrayOfUsers(users); return (R.indexOf('Alan') !== -1 && R.indexOf('Jeff') !== -1 && R.indexOf('Sarah') !== -1 && R.indexOf('Ryan') !== -1 && R.indexOf('Sam') !== -1 && R.indexOf('Lewis') !== -1); })() === true);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-all-an-arrays-items-using-for-loops.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-all-an-arrays-items-using-for-loops.chinese.md
index 5d80fb30bb..fb6f3e7aa5 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-all-an-arrays-items-using-for-loops.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-all-an-arrays-items-using-for-loops.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 使用for循环遍历所有数组的项目
```yml
tests:
- text: 'filteredArray([[10, 8, 3], [14, 6, 23], [3, 18, 6]], 18)
应该返回[ [10, 8, 3], [14, 6, 23] ]
'
- testString: 'assert.deepEqual(filteredArray([ [10, 8, 3], [14, 6, 23], [3, 18, 6] ], 18), [[10, 8, 3], [14, 6, 23]], "filteredArray([[10, 8, 3], [14, 6, 23], [3, 18, 6]], 18)
should return [ [10, 8, 3], [14, 6, 23] ]
");'
+ testString: assert.deepEqual(filteredArray([ [10, 8, 3], [14, 6, 23], [3, 18, 6] ], 18), [[10, 8, 3], [14, 6, 23]]);
- text: 'filteredArray([ ["trumpets", 2], ["flutes", 4], ["saxophones", 2] ], 2)
应返回[ ["flutes", 4] ]
'
- testString: 'assert.deepEqual(filteredArray([ ["trumpets", 2], ["flutes", 4], ["saxophones", 2] ], 2), [["flutes", 4]], "filteredArray([ ["trumpets", 2], ["flutes", 4], ["saxophones", 2] ], 2)
should return [ ["flutes", 4] ]
");'
+ testString: assert.deepEqual(filteredArray([ ['trumpets', 2], ['flutes', 4], ['saxophones', 2] ], 2), [['flutes', 4]]);
- text: 'filteredArray([ ["amy", "beth", "sam"], ["dave", "sean", "peter"] ], "peter")
应该返回[ ["amy", "beth", "sam"] ]
'
- testString: 'assert.deepEqual(filteredArray([["amy", "beth", "sam"], ["dave", "sean", "peter"]], "peter"), [["amy", "beth", "sam"]], "filteredArray([ ["amy", "beth", "sam"], ["dave", "sean", "peter"] ], "peter")
should return [ ["amy", "beth", "sam"] ]
");'
+ testString: assert.deepEqual(filteredArray([['amy', 'beth', 'sam'], ['dave', 'sean', 'peter']], 'peter'), [['amy', 'beth', 'sam']]);
- text: 'filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3)
应该返回[ ]
'
- testString: 'assert.deepEqual(filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3), [], "filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3)
should return [ ]
");'
+ testString: assert.deepEqual(filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3), []);
- text: filteredArray
函数应该使用for
循环
- testString: 'assert.notStrictEqual(filteredArray.toString().search(/for/), -1, "The filteredArray
function should utilize a for
loop");'
+ testString: assert.notStrictEqual(filteredArray.toString().search(/for/), -1);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-array-stored-in-an-object.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-array-stored-in-an-object.chinese.md
index f982f2c8b2..8965c0cc25 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-array-stored-in-an-object.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-array-stored-in-an-object.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 修改存储在对象中的数组
```yml
tests:
- text: user
对象具有name
, age
和data
键
- testString: 'assert("name" in user && "age" in user && "data" in user, "The user
object has name
, age
, and data
keys");'
+ testString: assert('name' in user && 'age' in user && 'data' in user);
- text: addFriend
函数接受user
对象和friend
字符串作为参数,并将朋友添加到user
对象中的friends
数组
- testString: 'assert((function() { let L1 = user.data.friends.length; addFriend(user, "Sean"); let L2 = user.data.friends.length; return (L2 === L1 + 1); })(), "The addFriend
function accepts a user
object and a friend
string as arguments and adds the friend to the array of friends
in the user
object");'
+ testString: assert((function() { let L1 = user.data.friends.length; addFriend(user, 'Sean'); let L2 = user.data.friends.length; return (L2 === L1 + 1); })());
- text: 'addFriend(user, "Pete")
应该返回["Sam", "Kira", "Tomo", "Pete"]
'
- testString: 'assert.deepEqual((function() { delete user.data.friends; user.data.friends = ["Sam", "Kira", "Tomo"]; return addFriend(user, "Pete") })(), ["Sam", "Kira", "Tomo", "Pete"], "addFriend(user, "Pete")
should return ["Sam", "Kira", "Tomo", "Pete"]
");'
+ testString: assert.deepEqual((function() { delete user.data.friends; user.data.friends = ['Sam', 'Kira', 'Tomo']; return addFriend(user, 'Pete') })(), ['Sam', 'Kira', 'Tomo', 'Pete']);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.chinese.md
index 76f83e14d3..13f98ceadd 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 修改嵌套在对象中的对象
```yml
tests:
- text: userActivity
具有id
, date
和data
属性
- testString: 'assert("id" in userActivity && "date" in userActivity && "data" in userActivity, "userActivity
has id
, date
and data
properties");'
+ testString: assert('id' in userActivity && 'date' in userActivity && 'data' in userActivity);
- text: userActivity
具有设置为具有密钥totalUsers
和online
的对象的data
密钥
- testString: 'assert("totalUsers" in userActivity.data && "online" in userActivity.data, "userActivity
has a data
key set to an object with keys totalUsers
and online
");'
+ testString: assert('totalUsers' in userActivity.data && 'online' in userActivity.data);
- text: 嵌套在userActivity
data
键中的online
属性应设置为45
- testString: 'assert(userActivity.data.online === 45, "The online
property nested in the data
key of userActivity
should be set to 45
");'
+ testString: assert(userActivity.data.online === 45);
- text: online
属性使用点或括号表示法设置
- testString: 'assert.strictEqual(code.search(/online: 45/), -1, "The online
property is set using dot or bracket notation");'
+ testString: 'assert.strictEqual(code.search(/online: 45/), -1);'
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-from-an-array-with-pop-and-shift.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-from-an-array-with-pop-and-shift.chinese.md
index 5e7990ab50..858b776407 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-from-an-array-with-pop-and-shift.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-from-an-array-with-pop-and-shift.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 使用pop()和shift()从数组中删除项
```yml
tests:
- text: 'popShift(["challenge", "is", "not", "complete"])
应返回["challenge", "complete"]
'
- testString: 'assert.deepEqual(popShift(["challenge", "is", "not", "complete"]), ["challenge", "complete"], "popShift(["challenge", "is", "not", "complete"])
should return ["challenge", "complete"]
");'
+ testString: assert.deepEqual(popShift(['challenge', 'is', 'not', 'complete']), ["challenge", "complete"]);
- text: popShift
函数应该使用pop()
方法
- testString: 'assert.notStrictEqual(popShift.toString().search(/\.pop\(/), -1, "The popShift
function should utilize the pop()
method");'
+ testString: assert.notStrictEqual(popShift.toString().search(/\.pop\(/), -1);
- text: popShift
函数应该使用shift()
方法
- testString: 'assert.notStrictEqual(popShift.toString().search(/\.shift\(/), -1, "The popShift
function should utilize the shift()
method");'
+ testString: assert.notStrictEqual(popShift.toString().search(/\.shift\(/), -1);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-an-array-to-store-a-collection-of-data.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-an-array-to-store-a-collection-of-data.chinese.md
index 73e8dba080..a78b6739c9 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-an-array-to-store-a-collection-of-data.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-an-array-to-store-a-collection-of-data.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 使用数组存储数据集合
```yml
tests:
- text: yourArray是一个数组
- testString: 'assert.strictEqual(Array.isArray(yourArray), true, "yourArray is an array");'
+ testString: assert.strictEqual(Array.isArray(yourArray), true);
- text: yourArray
至少有5个元素
- testString: 'assert.isAtLeast(yourArray.length, 5, "yourArray
is at least 5 elements long");'
+ testString: assert.isAtLeast(yourArray.length, 5);
- text: yourArray
至少包含一个boolean
- testString: 'assert(yourArray.filter( el => typeof el === "boolean").length >= 1, "yourArray
contains at least one boolean
");'
+ testString: assert(yourArray.filter( el => typeof el === 'boolean').length >= 1);
- text: yourArray
至少包含一个number
- testString: 'assert(yourArray.filter( el => typeof el === "number").length >= 1, "yourArray
contains at least one number
");'
+ testString: assert(yourArray.filter( el => typeof el === 'number').length >= 1);
- text: yourArray
至少包含一个string
- testString: 'assert(yourArray.filter( el => typeof el === "string").length >= 1, "yourArray
contains at least one string
");'
+ testString: assert(yourArray.filter( el => typeof el === 'string').length >= 1);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.chinese.md
index 6e23ddeef2..afef6fd1f3 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用删除关键字删除对象属性
```yml
tests:
- text: foods
对象只有三个键: apples
, grapes
和bananas
- testString: 'assert(!foods.hasOwnProperty("oranges") && !foods.hasOwnProperty("plums") && !foods.hasOwnProperty("strawberries") && Object.keys(foods).length === 3, "The foods
object only has three keys: apples
, grapes
, and bananas
");'
+ testString: 'assert(!foods.hasOwnProperty(''oranges'') && !foods.hasOwnProperty(''plums'') && !foods.hasOwnProperty(''strawberries'') && Object.keys(foods).length === 3);'
- text: 使用delete
oranges
, plums
和strawberries
键
- testString: 'assert(code.search(/oranges:/) !== -1 && code.search(/plums:/) !== -1 && code.search(/strawberries:/) !== -1, "The oranges
, plums
, and strawberries
keys are removed using delete
");'
+ testString: assert(code.search(/oranges:/) !== -1 && code.search(/plums:/) !== -1 && code.search(/strawberries:/) !== -1);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.chinese.md
index ef16874544..337de7e8c9 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用索引访问数组数据
```yml
tests:
- text: 变量myData
应该等于myArray
的第一个值。
- testString: 'assert((function(){if(typeof myArray !== "undefined" && typeof myData !== "undefined" && myArray[0] === myData){return true;}else{return false;}})(), "The variable myData
should equal the first value of myArray
.");'
+ testString: assert((function(){if(typeof myArray !== 'undefined' && typeof myData !== 'undefined' && myArray[0] === myData){return true;}else{return false;}})());
- text: 应使用括号表示法访问变量myArray
的数据。
- testString: 'assert((function(){if(code.match(/\s*=\s*myArray\[0\]/g)){return true;}else{return false;}})(), "The data in variable myArray
should be accessed using bracket notation.");'
+ testString: assert((function(){if(code.match(/\s*=\s*myArray\[0\]/g)){return true;}else{return false;}})());
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.chinese.md
index 381e0c1956..d14bf1b8a9 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 访问带索引的多维数组
```yml
tests:
- text: myData
应该等于8
。
- testString: 'assert(myData === 8, "myData
should be equal to 8
.");'
+ testString: assert(myData === 8);
- text: 您应该使用括号表示法从myArray
读取正确的值。
- testString: 'assert(/myArray\[2\]\[1\]/g.test(code) && !/myData\s*=\s*(?:.*[-+*/%]|\d)/g.test(code), "You should be using bracket notation to read the correct value from myArray
.");'
+ testString: assert(/myData=myArray\[2\]\[1\]/.test(code.replace(/\s/g, '')));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.chinese.md
index df3b117cdc..76086061e0 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 访问嵌套数组
```yml
tests:
- text: secondTree
应该等于“松树”
- testString: 'assert(secondTree === "pine", "secondTree
should equal "pine"");'
+ testString: assert(secondTree === "pine");
- text: 使用点和括号表示法访问myPlants
- testString: 'assert(/=\s*myPlants\[1\].list\[1\]/.test(code), "Use dot and bracket notation to access myPlants
");'
+ testString: assert(/=\s*myPlants\[1\].list\[1\]/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-objects.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-objects.chinese.md
index 8def132320..420f93bc68 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-objects.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-objects.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 访问嵌套对象
```yml
tests:
- text: gloveBoxContents
应该等于“地图”
- testString: 'assert(gloveBoxContents === "maps", "gloveBoxContents
should equal "maps"");'
+ testString: assert(gloveBoxContents === "maps");
- text: 使用点和括号表示法访问myStorage
- testString: 'assert(/=\s*myStorage\.car\.inside\[\s*("|")glove box\1\s*\]/g.test(code), "Use dot and bracket notation to access myStorage
");'
+ testString: assert(/=\s*myStorage\.car\.inside\[\s*("|')glove box\1\s*\]/g.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.chinese.md
index cc7c032137..cfdffa6002 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 使用括号表示法访问对象属性
```yml
tests:
- text: entreeValue
应该是一个字符串
- testString: 'assert(typeof entreeValue === "string" , "entreeValue
should be a string");'
+ testString: assert(typeof entreeValue === 'string' );
- text: entreeValue
的值应该是"hamburger"
- testString: 'assert(entreeValue === "hamburger" , "The value of entreeValue
should be "hamburger"
");'
+ testString: assert(entreeValue === 'hamburger' );
- text: drinkValue
应该是一个字符串
- testString: 'assert(typeof drinkValue === "string" , "drinkValue
should be a string");'
+ testString: assert(typeof drinkValue === 'string' );
- text: drinkValue
的值应该是"water"
- testString: 'assert(drinkValue === "water" , "The value of drinkValue
should be "water"
");'
+ testString: assert(drinkValue === 'water' );
- text: 您应该使用括号表示法两次
- testString: 'assert(code.match(/testObj\s*?\[("|")[^""]+\1\]/g).length > 1, "You should use bracket notation twice");'
+ testString: assert(code.match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.chinese.md
index 4e0ac5691c..742d0dbf36 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 使用点表示法访问对象属性
```yml
tests:
- text: hatValue
应该是一个字符串
- testString: 'assert(typeof hatValue === "string" , "hatValue
should be a string");'
+ testString: assert(typeof hatValue === 'string' );
- text: hatValue
的值应该是"ballcap"
- testString: 'assert(hatValue === "ballcap" , "The value of hatValue
should be "ballcap"
");'
+ testString: assert(hatValue === 'ballcap' );
- text: shirtValue
应该是一个字符串
- testString: 'assert(typeof shirtValue === "string" , "shirtValue
should be a string");'
+ testString: assert(typeof shirtValue === 'string' );
- text: shirtValue
的值应该是"jersey"
- testString: 'assert(shirtValue === "jersey" , "The value of shirtValue
should be "jersey"
");'
+ testString: assert(shirtValue === 'jersey' );
- text: 你应该使用点符号两次
- testString: 'assert(code.match(/testObj\.\w+/g).length > 1, "You should use dot notation twice");'
+ testString: assert(code.match(/testObj\.\w+/g).length > 1);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.chinese.md
index fc7c60e94a..317b232ab7 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.chinese.md
@@ -18,17 +18,17 @@ localeTitle: 使用变量访问对象属性
```yml
tests:
- text: playerNumber
应该是一个数字
- testString: 'assert(typeof playerNumber === "number", "playerNumber
should be a number");'
+ testString: assert(typeof playerNumber === 'number');
- text: 变量player
应该是一个字符串
- testString: 'assert(typeof player === "string", "The variable player
should be a string");'
+ testString: assert(typeof player === 'string');
- text: player
的价值应该是“蒙大拿”
- testString: 'assert(player === "Montana", "The value of player
should be "Montana"");'
+ testString: assert(player === 'Montana');
- text: 您应该使用括号表示法来访问testObj
- testString: 'assert(/testObj\s*?\[.*?\]/.test(code),"You should use bracket notation to access testObj
");'
+ testString: assert(/testObj\s*?\[.*?\]/.test(code));
- text: 您不应该直接将值Montana
分配给变量player
。
- testString: 'assert(!code.match(/player\s*=\s*"|\"\s*Montana\s*"|\"\s*;/gi),"You should not assign the value Montana
to the variable player
directly.");'
+ testString: assert(!code.match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi));
- text: 您应该在括号表示法中使用变量playerNumber
- testString: 'assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code),"You should be using the variable playerNumber
in your bracket notation");'
+ testString: assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.chinese.md
index 239ecc0eec..dca2e8a27e 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 将新属性添加到JavaScript对象
```yml
tests:
- text: 将属性"bark"
添加到myDog
。
- testString: 'assert(myDog.bark !== undefined, "Add the property "bark"
to myDog
.");'
+ testString: assert(myDog.bark !== undefined);
- text: 不要在设置部分添加"bark"
- testString: 'assert(!/bark[^\n]:/.test(code), "Do not add "bark"
to the setup section");'
+ testString: assert(!/bark[^\n]:/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.chinese.md
index d4d4981494..6621a1f358 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用JavaScript添加两个数字
```yml
tests:
- text: sum
应该等于20
- testString: 'assert(sum === 20, "sum
should equal 20
");'
+ testString: assert(sum === 20);
- text: 使用+
运算符
- testString: 'assert(/\+/.test(code), "Use the +
operator");'
+ testString: assert(/\+/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.chinese.md
index c63c19d9ae..5ff806a4b1 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.chinese.md
@@ -18,21 +18,21 @@ localeTitle: 在交换机语句中添加默认选项
```yml
tests:
- text: switchOfStuff("a")
的值应为“apple”
- testString: 'assert(switchOfStuff("a") === "apple", "switchOfStuff("a")
should have a value of "apple"");'
+ testString: assert(switchOfStuff("a") === "apple");
- text: switchOfStuff("b")
的值应为“bird”
- testString: 'assert(switchOfStuff("b") === "bird", "switchOfStuff("b")
should have a value of "bird"");'
+ testString: assert(switchOfStuff("b") === "bird");
- text: switchOfStuff("c")
的值应为“cat”
- testString: 'assert(switchOfStuff("c") === "cat", "switchOfStuff("c")
should have a value of "cat"");'
+ testString: assert(switchOfStuff("c") === "cat");
- text: switchOfStuff("d")
的值应为“stuff”
- testString: 'assert(switchOfStuff("d") === "stuff", "switchOfStuff("d")
should have a value of "stuff"");'
+ testString: assert(switchOfStuff("d") === "stuff");
- text: switchOfStuff(4)
的值应为“stuff”
- testString: 'assert(switchOfStuff(4) === "stuff", "switchOfStuff(4)
should have a value of "stuff"");'
+ testString: assert(switchOfStuff(4) === "stuff");
- text: 您不应该使用任何if
或else
语句
- testString: 'assert(!/else/g.test(code) || !/if/g.test(code), "You should not use any if
or else
statements");'
+ testString: assert(!/else/g.test(code) || !/if/g.test(code));
- text: 您应该使用default
语句
- testString: 'assert(switchOfStuff("string-to-trigger-default-case") === "stuff", "You should use a default
statement");'
+ testString: assert(switchOfStuff("string-to-trigger-default-case") === "stuff");
- text: 你应该至少有3个break
语句
- testString: 'assert(code.match(/break/g).length > 2, "You should have at least 3 break
statements");'
+ testString: assert(code.match(/break/g).length > 2);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.chinese.md
index 5382a192c7..439c271ffe 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 将变量附加到字符串
```yml
tests:
- text: someAdjective
应设置为至少3个字符长的字符串
- testString: 'assert(typeof someAdjective !== "undefined" && someAdjective.length > 2, "someAdjective
should be set to a string at least 3 characters long");'
+ testString: assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2);
- text: 使用+=
运算符将someAdjective
附加到myStr
- testString: 'assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0, "Append someAdjective
to myStr
using the +=
operator");'
+ testString: assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.chinese.md
index e830ba55cd..f57e04d560 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 具有返回值的分配
```yml
tests:
- text: processed
的值应为2
- testString: 'assert(processed === 2, "processed
should have a value of 2
");'
+ testString: assert(processed === 2);
- text: 您应该将processArg
分配给已processed
- testString: 'assert(/processed\s*=\s*processArg\(\s*7\s*\)\s*;/.test(code), "You should assign processArg
to processed
");'
+ testString: assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.chinese.md
index 9159f9ed1a..611698c5e7 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 构建JavaScript对象
```yml
tests:
- text: myDog
应该包含属性name
,它应该是一个string
。
- testString: 'assert((function(z){if(z.hasOwnProperty("name") && z.name !== undefined && typeof z.name === "string"){return true;}else{return false;}})(myDog), "myDog
should contain the property name
and it should be a string
.");'
+ testString: assert((function(z){if(z.hasOwnProperty("name") && z.name !== undefined && typeof z.name === "string"){return true;}else{return false;}})(myDog));
- text: myDog
应该包含属性legs
,它应该是一个number
。
- testString: 'assert((function(z){if(z.hasOwnProperty("legs") && z.legs !== undefined && typeof z.legs === "number"){return true;}else{return false;}})(myDog), "myDog
should contain the property legs
and it should be a number
.");'
+ testString: assert((function(z){if(z.hasOwnProperty("legs") && z.legs !== undefined && typeof z.legs === "number"){return true;}else{return false;}})(myDog));
- text: myDog
应该包含属性tails
,它应该是一个number
。
- testString: 'assert((function(z){if(z.hasOwnProperty("tails") && z.tails !== undefined && typeof z.tails === "number"){return true;}else{return false;}})(myDog), "myDog
should contain the property tails
and it should be a number
.");'
+ testString: assert((function(z){if(z.hasOwnProperty("tails") && z.tails !== undefined && typeof z.tails === "number"){return true;}else{return false;}})(myDog));
- text: myDog
应该包含属性friends
,它应该是一个array
。
- testString: 'assert((function(z){if(z.hasOwnProperty("friends") && z.friends !== undefined && Array.isArray(z.friends)){return true;}else{return false;}})(myDog), "myDog
should contain the property friends
and it should be an array
.");'
+ testString: assert((function(z){if(z.hasOwnProperty("friends") && z.friends !== undefined && Array.isArray(z.friends)){return true;}else{return false;}})(myDog));
- text: myDog
应该只包含所有给定的属性。
- testString: 'assert((function(z){return Object.keys(z).length === 4;})(myDog), "myDog
should only contain all the given properties.");'
+ testString: assert((function(z){return Object.keys(z).length === 4;})(myDog));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.chinese.md
index 35f696cb97..69e57fa550 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.chinese.md
@@ -18,31 +18,31 @@ localeTitle: 链接如果其他声明
```yml
tests:
- text: 你应该至少有四个else
语句
- testString: 'assert(code.match(/else/g).length > 3, "You should have at least four else
statements");'
+ testString: assert(code.match(/else/g).length > 3);
- text: 你应该至少有四个if
语句
- testString: 'assert(code.match(/if/g).length > 3, "You should have at least four if
statements");'
+ testString: assert(code.match(/if/g).length > 3);
- text: 你应该至少有一个return
语句
- testString: 'assert(code.match(/return/g).length >= 1, "You should have at least one return
statement");'
+ testString: assert(code.match(/return/g).length >= 1);
- text: testSize(0)
应该返回“Tiny”
- testString: 'assert(testSize(0) === "Tiny", "testSize(0)
should return "Tiny"");'
+ testString: assert(testSize(0) === "Tiny");
- text: testSize(4)
应该返回“Tiny”
- testString: 'assert(testSize(4) === "Tiny", "testSize(4)
should return "Tiny"");'
+ testString: assert(testSize(4) === "Tiny");
- text: testSize(5)
应返回“Small”
- testString: 'assert(testSize(5) === "Small", "testSize(5)
should return "Small"");'
+ testString: assert(testSize(5) === "Small");
- text: testSize(8)
应该返回“Small”
- testString: 'assert(testSize(8) === "Small", "testSize(8)
should return "Small"");'
+ testString: assert(testSize(8) === "Small");
- text: testSize(10)
应该返回“Medium”
- testString: 'assert(testSize(10) === "Medium", "testSize(10)
should return "Medium"");'
+ testString: assert(testSize(10) === "Medium");
- text: testSize(14)
应返回“Medium”
- testString: 'assert(testSize(14) === "Medium", "testSize(14)
should return "Medium"");'
+ testString: assert(testSize(14) === "Medium");
- text: testSize(15)
应该返回“Large”
- testString: 'assert(testSize(15) === "Large", "testSize(15)
should return "Large"");'
+ testString: assert(testSize(15) === "Large");
- text: testSize(17)
应该返回“Large”
- testString: 'assert(testSize(17) === "Large", "testSize(17)
should return "Large"");'
+ testString: assert(testSize(17) === "Large");
- text: testSize(20)
应该返回“巨大”
- testString: 'assert(testSize(20) === "Huge", "testSize(20)
should return "Huge"");'
+ testString: assert(testSize(20) === "Huge");
- text: testSize(25)
应该返回“巨大”
- testString: 'assert(testSize(25) === "Huge", "testSize(25)
should return "Huge"");'
+ testString: assert(testSize(25) === "Huge");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.chinese.md
index 386ca98226..fb517a918b 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 评论您的JavaScript代码
```yml
tests:
- text: 创建一个包含至少五个字母的//
样式注释。
- testString: 'assert(code.match(/(\/\/)...../g), "Create a //
style comment that contains at least five letters.");'
+ testString: assert(code.match(/(\/\/)...../g));
- text: 创建包含至少五个字母的/* */
样式注释。
- testString: 'assert(code.match(/(\/\*)([^\/]{5,})(?=\*\/)/gm), "Create a /* */
style comment that contains at least five letters.");'
+ testString: assert(code.match(/(\/\*)([^\/]{5,})(?=\*\/)/gm));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.chinese.md
index d84c6c8e7d..df1f2b3dd8 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 与平等算子的比较
```yml
tests:
- text: testEqual(10)
应该返回“Not Equal”
- testString: 'assert(testEqual(10) === "Not Equal", "testEqual(10)
should return "Not Equal"");'
+ testString: assert(testEqual(10) === "Not Equal");
- text: testEqual(12)
应返回“Equal”
- testString: 'assert(testEqual(12) === "Equal", "testEqual(12)
should return "Equal"");'
+ testString: assert(testEqual(12) === "Equal");
- text: testEqual("12")
应返回“Equal”
- testString: 'assert(testEqual("12") === "Equal", "testEqual("12")
should return "Equal"");'
+ testString: assert(testEqual("12") === "Equal");
- text: 您应该使用==
运算符
- testString: 'assert(code.match(/==/g) && !code.match(/===/g), "You should use the ==
operator");'
+ testString: assert(code.match(/==/g) && !code.match(/===/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.chinese.md
index 69aed3dde2..a6b60075fc 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.chinese.md
@@ -18,21 +18,21 @@ localeTitle: 与大于运营商的比较
```yml
tests:
- text: testGreaterThan(0)
应返回“10或Under”
- testString: 'assert(testGreaterThan(0) === "10 or Under", "testGreaterThan(0)
should return "10 or Under"");'
+ testString: assert(testGreaterThan(0) === "10 or Under");
- text: testGreaterThan(10)
应返回“10或Under”
- testString: 'assert(testGreaterThan(10) === "10 or Under", "testGreaterThan(10)
should return "10 or Under"");'
+ testString: assert(testGreaterThan(10) === "10 or Under");
- text: testGreaterThan(11)
应该返回“Over 10”
- testString: 'assert(testGreaterThan(11) === "Over 10", "testGreaterThan(11)
should return "Over 10"");'
+ testString: assert(testGreaterThan(11) === "Over 10");
- text: testGreaterThan(99)
应该返回“Over 10”
- testString: 'assert(testGreaterThan(99) === "Over 10", "testGreaterThan(99)
should return "Over 10"");'
+ testString: assert(testGreaterThan(99) === "Over 10");
- text: testGreaterThan(100)
应该返回“Over 10”
- testString: 'assert(testGreaterThan(100) === "Over 10", "testGreaterThan(100)
should return "Over 10"");'
+ testString: assert(testGreaterThan(100) === "Over 10");
- text: testGreaterThan(101)
应返回“超过100”
- testString: 'assert(testGreaterThan(101) === "Over 100", "testGreaterThan(101)
should return "Over 100"");'
+ testString: assert(testGreaterThan(101) === "Over 100");
- text: testGreaterThan(150)
应该返回“超过100”
- testString: 'assert(testGreaterThan(150) === "Over 100", "testGreaterThan(150)
should return "Over 100"");'
+ testString: assert(testGreaterThan(150) === "Over 100");
- text: 您应该至少使用>
运算符两次
- testString: 'assert(code.match(/val\s*>\s*("|")*\d+("|")*/g).length > 1, "You should use the >
operator at least twice");'
+ testString: assert(code.match(/val\s*>\s*('|")*\d+('|")*/g).length > 1);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.chinese.md
index b55d54bda8..bdd2d09621 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.chinese.md
@@ -18,21 +18,21 @@ localeTitle: 与大于或等于运算符的比较
```yml
tests:
- text: testGreaterOrEqual(0)
应返回“小于10”
- testString: 'assert(testGreaterOrEqual(0) === "Less than 10", "testGreaterOrEqual(0)
should return "Less than 10"");'
+ testString: assert(testGreaterOrEqual(0) === "Less than 10");
- text: testGreaterOrEqual(9)
应返回“小于10”
- testString: 'assert(testGreaterOrEqual(9) === "Less than 10", "testGreaterOrEqual(9)
should return "Less than 10"");'
+ testString: assert(testGreaterOrEqual(9) === "Less than 10");
- text: testGreaterOrEqual(10)
应返回“10或Over”
- testString: 'assert(testGreaterOrEqual(10) === "10 or Over", "testGreaterOrEqual(10)
should return "10 or Over"");'
+ testString: assert(testGreaterOrEqual(10) === "10 or Over");
- text: testGreaterOrEqual(11)
应返回“10或Over”
- testString: 'assert(testGreaterOrEqual(11) === "10 or Over", "testGreaterOrEqual(11)
should return "10 or Over"");'
+ testString: assert(testGreaterOrEqual(11) === "10 or Over");
- text: testGreaterOrEqual(19)
应返回“10或Over”
- testString: 'assert(testGreaterOrEqual(19) === "10 or Over", "testGreaterOrEqual(19)
should return "10 or Over"");'
+ testString: assert(testGreaterOrEqual(19) === "10 or Over");
- text: testGreaterOrEqual(100)
应该返回“20或Over”
- testString: 'assert(testGreaterOrEqual(100) === "20 or Over", "testGreaterOrEqual(100)
should return "20 or Over"");'
+ testString: assert(testGreaterOrEqual(100) === "20 or Over");
- text: testGreaterOrEqual(21)
应返回“20或Over”
- testString: 'assert(testGreaterOrEqual(21) === "20 or Over", "testGreaterOrEqual(21)
should return "20 or Over"");'
+ testString: assert(testGreaterOrEqual(21) === "20 or Over");
- text: 您应该使用>=
运算符至少两次
- testString: 'assert(code.match(/val\s*>=\s*("|")*\d+("|")*/g).length > 1, "You should use the >=
operator at least twice");'
+ testString: assert(code.match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.chinese.md
index e149c718da..be1b45629a 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.chinese.md
@@ -18,17 +18,17 @@ localeTitle: 与不等式算子的比较
```yml
tests:
- text: testNotEqual(99)
应返回“Equal”
- testString: 'assert(testNotEqual(99) === "Equal", "testNotEqual(99)
should return "Equal"");'
+ testString: assert(testNotEqual(99) === "Equal");
- text: testNotEqual("99")
应该返回“Equal”
- testString: 'assert(testNotEqual("99") === "Equal", "testNotEqual("99")
should return "Equal"");'
+ testString: assert(testNotEqual("99") === "Equal");
- text: testNotEqual(12)
应该返回“Not Equal”
- testString: 'assert(testNotEqual(12) === "Not Equal", "testNotEqual(12)
should return "Not Equal"");'
+ testString: assert(testNotEqual(12) === "Not Equal");
- text: testNotEqual("12")
应该返回“Not Equal”
- testString: 'assert(testNotEqual("12") === "Not Equal", "testNotEqual("12")
should return "Not Equal"");'
+ testString: assert(testNotEqual("12") === "Not Equal");
- text: testNotEqual("bob")
应返回“Not Equal”
- testString: 'assert(testNotEqual("bob") === "Not Equal", "testNotEqual("bob")
should return "Not Equal"");'
+ testString: assert(testNotEqual("bob") === "Not Equal");
- text: 你应该使用!=
运算符
- testString: 'assert(code.match(/(?!!==)!=/), "You should use the !=
operator");'
+ testString: assert(code.match(/(?!!==)!=/));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.chinese.md
index e440579845..ffe4352d1d 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.chinese.md
@@ -18,19 +18,19 @@ localeTitle: 与小于算子的比较
```yml
tests:
- text: testLessThan(0)
应该返回“25岁以下”
- testString: 'assert(testLessThan(0) === "Under 25", "testLessThan(0)
should return "Under 25"");'
+ testString: assert(testLessThan(0) === "Under 25");
- text: testLessThan(24)
应该返回“25岁以下”
- testString: 'assert(testLessThan(24) === "Under 25", "testLessThan(24)
should return "Under 25"");'
+ testString: assert(testLessThan(24) === "Under 25");
- text: testLessThan(25)
应该返回“55岁以下”
- testString: 'assert(testLessThan(25) === "Under 55", "testLessThan(25)
should return "Under 55"");'
+ testString: assert(testLessThan(25) === "Under 55");
- text: testLessThan(54)
应该返回“55岁以下”
- testString: 'assert(testLessThan(54) === "Under 55", "testLessThan(54)
should return "Under 55"");'
+ testString: assert(testLessThan(54) === "Under 55");
- text: testLessThan(55)
应返回“55或以上”
- testString: 'assert(testLessThan(55) === "55 or Over", "testLessThan(55)
should return "55 or Over"");'
+ testString: assert(testLessThan(55) === "55 or Over");
- text: testLessThan(99)
应返回“55或以上”
- testString: 'assert(testLessThan(99) === "55 or Over", "testLessThan(99)
should return "55 or Over"");'
+ testString: assert(testLessThan(99) === "55 or Over");
- text: 您应该至少使用<
运算符两次
- testString: 'assert(code.match(/val\s*<\s*("|")*\d+("|")*/g).length > 1, "You should use the <
operator at least twice");'
+ testString: assert(code.match(/val\s*<\s*('|")*\d+('|")*/g).length > 1);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.chinese.md
index 7cc45028ce..9645eb2eae 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.chinese.md
@@ -18,21 +18,21 @@ localeTitle: 与小于或等于运算符的比较
```yml
tests:
- text: testLessOrEqual(0)
应该返回“小于或等于12”
- testString: 'assert(testLessOrEqual(0) === "Smaller Than or Equal to 12", "testLessOrEqual(0)
should return "Smaller Than or Equal to 12"");'
+ testString: assert(testLessOrEqual(0) === "Smaller Than or Equal to 12");
- text: testLessOrEqual(11)
应返回“小于或等于12”
- testString: 'assert(testLessOrEqual(11) === "Smaller Than or Equal to 12", "testLessOrEqual(11)
should return "Smaller Than or Equal to 12"");'
+ testString: assert(testLessOrEqual(11) === "Smaller Than or Equal to 12");
- text: testLessOrEqual(12)
应返回“小于或等于12”
- testString: 'assert(testLessOrEqual(12) === "Smaller Than or Equal to 12", "testLessOrEqual(12)
should return "Smaller Than or Equal to 12"");'
+ testString: assert(testLessOrEqual(12) === "Smaller Than or Equal to 12");
- text: testLessOrEqual(23)
应返回“小于或等于24”
- testString: 'assert(testLessOrEqual(23) === "Smaller Than or Equal to 24", "testLessOrEqual(23)
should return "Smaller Than or Equal to 24"");'
+ testString: assert(testLessOrEqual(23) === "Smaller Than or Equal to 24");
- text: testLessOrEqual(24)
应返回“小于或等于24”
- testString: 'assert(testLessOrEqual(24) === "Smaller Than or Equal to 24", "testLessOrEqual(24)
should return "Smaller Than or Equal to 24"");'
+ testString: assert(testLessOrEqual(24) === "Smaller Than or Equal to 24");
- text: testLessOrEqual(25)
应该返回“超过24”
- testString: 'assert(testLessOrEqual(25) === "More Than 24", "testLessOrEqual(25)
should return "More Than 24"");'
+ testString: assert(testLessOrEqual(25) === "More Than 24");
- text: testLessOrEqual(55)
应该返回“超过24”
- testString: 'assert(testLessOrEqual(55) === "More Than 24", "testLessOrEqual(55)
should return "More Than 24"");'
+ testString: assert(testLessOrEqual(55) === "More Than 24");
- text: 你应该至少使用<=
运算符两次
- testString: 'assert(code.match(/val\s*<=\s*("|")*\d+("|")*/g).length > 1, "You should use the <=
operator at least twice");'
+ testString: assert(code.match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.chinese.md
index 941d2aee19..af99e042f2 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 与严格平等算子的比较
```yml
tests:
- text: testStrict(10)
应返回“Not Equal”
- testString: 'assert(testStrict(10) === "Not Equal", "testStrict(10)
should return "Not Equal"");'
+ testString: assert(testStrict(10) === "Not Equal");
- text: testStrict(7)
应返回“Equal”
- testString: 'assert(testStrict(7) === "Equal", "testStrict(7)
should return "Equal"");'
+ testString: assert(testStrict(7) === "Equal");
- text: testStrict("7")
应返回“Not Equal”
- testString: 'assert(testStrict("7") === "Not Equal", "testStrict("7")
should return "Not Equal"");'
+ testString: assert(testStrict("7") === "Not Equal");
- text: 您应该使用===
运算符
- testString: 'assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0, "You should use the ===
operator");'
+ testString: assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.chinese.md
index 7d5d66c430..6c10a3c05b 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 与严格不等式算子的比较
```yml
tests:
- text: testStrictNotEqual(17)
应返回“Equal”
- testString: 'assert(testStrictNotEqual(17) === "Equal", "testStrictNotEqual(17)
should return "Equal"");'
+ testString: assert(testStrictNotEqual(17) === "Equal");
- text: testStrictNotEqual("17")
应返回“Not Equal”
- testString: 'assert(testStrictNotEqual("17") === "Not Equal", "testStrictNotEqual("17")
should return "Not Equal"");'
+ testString: assert(testStrictNotEqual("17") === "Not Equal");
- text: testStrictNotEqual(12)
应该返回“Not Equal”
- testString: 'assert(testStrictNotEqual(12) === "Not Equal", "testStrictNotEqual(12)
should return "Not Equal"");'
+ testString: assert(testStrictNotEqual(12) === "Not Equal");
- text: testStrictNotEqual("bob")
应返回“Not Equal”
- testString: 'assert(testStrictNotEqual("bob") === "Not Equal", "testStrictNotEqual("bob")
should return "Not Equal"");'
+ testString: assert(testStrictNotEqual("bob") === "Not Equal");
- text: 你应该使用!==
运算符
- testString: 'assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0, "You should use the !==
operator");'
+ testString: assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.chinese.md
index f02a1f319e..5e4aac8149 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.chinese.md
@@ -18,25 +18,25 @@ localeTitle: 与逻辑和运算符的比较
```yml
tests:
- text: 你应该使用一次&&
运算符
- testString: 'assert(code.match(/&&/g).length === 1, "You should use the &&
operator once");'
+ testString: assert(code.match(/&&/g).length === 1);
- text: 你应该只有一个if
语句
- testString: 'assert(code.match(/if/g).length === 1, "You should only have one if
statement");'
+ testString: assert(code.match(/if/g).length === 1);
- text: testLogicalAnd(0)
应返回“否”
- testString: 'assert(testLogicalAnd(0) === "No", "testLogicalAnd(0)
should return "No"");'
+ testString: assert(testLogicalAnd(0) === "No");
- text: testLogicalAnd(24)
应返回“否”
- testString: 'assert(testLogicalAnd(24) === "No", "testLogicalAnd(24)
should return "No"");'
+ testString: assert(testLogicalAnd(24) === "No");
- text: testLogicalAnd(25)
应返回“是”
- testString: 'assert(testLogicalAnd(25) === "Yes", "testLogicalAnd(25)
should return "Yes"");'
+ testString: assert(testLogicalAnd(25) === "Yes");
- text: testLogicalAnd(30)
应该返回“是”
- testString: 'assert(testLogicalAnd(30) === "Yes", "testLogicalAnd(30)
should return "Yes"");'
+ testString: assert(testLogicalAnd(30) === "Yes");
- text: testLogicalAnd(50)
应该返回“是”
- testString: 'assert(testLogicalAnd(50) === "Yes", "testLogicalAnd(50)
should return "Yes"");'
+ testString: assert(testLogicalAnd(50) === "Yes");
- text: testLogicalAnd(51)
应返回“否”
- testString: 'assert(testLogicalAnd(51) === "No", "testLogicalAnd(51)
should return "No"");'
+ testString: assert(testLogicalAnd(51) === "No");
- text: testLogicalAnd(75)
应返回“否”
- testString: 'assert(testLogicalAnd(75) === "No", "testLogicalAnd(75)
should return "No"");'
+ testString: assert(testLogicalAnd(75) === "No");
- text: testLogicalAnd(80)
应返回“否”
- testString: 'assert(testLogicalAnd(80) === "No", "testLogicalAnd(80)
should return "No"");'
+ testString: assert(testLogicalAnd(80) === "No");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.chinese.md
index 45c46097c0..f5be8fd788 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.chinese.md
@@ -18,25 +18,25 @@ localeTitle: 与逻辑或运算符的比较
```yml
tests:
- text: 你应该使用||
操作员一次
- testString: 'assert(code.match(/\|\|/g).length === 1, "You should use the ||
operator once");'
+ testString: assert(code.match(/\|\|/g).length === 1);
- text: 你应该只有一个if
语句
- testString: 'assert(code.match(/if/g).length === 1, "You should only have one if
statement");'
+ testString: assert(code.match(/if/g).length === 1);
- text: testLogicalOr(0)
应返回“Outside”
- testString: 'assert(testLogicalOr(0) === "Outside", "testLogicalOr(0)
should return "Outside"");'
+ testString: assert(testLogicalOr(0) === "Outside");
- text: testLogicalOr(9)
应返回“Outside”
- testString: 'assert(testLogicalOr(9) === "Outside", "testLogicalOr(9)
should return "Outside"");'
+ testString: assert(testLogicalOr(9) === "Outside");
- text: testLogicalOr(10)
应返回“Inside”
- testString: 'assert(testLogicalOr(10) === "Inside", "testLogicalOr(10)
should return "Inside"");'
+ testString: assert(testLogicalOr(10) === "Inside");
- text: testLogicalOr(15)
应返回“Inside”
- testString: 'assert(testLogicalOr(15) === "Inside", "testLogicalOr(15)
should return "Inside"");'
+ testString: assert(testLogicalOr(15) === "Inside");
- text: testLogicalOr(19)
应该返回“Inside”
- testString: 'assert(testLogicalOr(19) === "Inside", "testLogicalOr(19)
should return "Inside"");'
+ testString: assert(testLogicalOr(19) === "Inside");
- text: testLogicalOr(20)
应该返回“Inside”
- testString: 'assert(testLogicalOr(20) === "Inside", "testLogicalOr(20)
should return "Inside"");'
+ testString: assert(testLogicalOr(20) === "Inside");
- text: testLogicalOr(21)
应该返回“Outside”
- testString: 'assert(testLogicalOr(21) === "Outside", "testLogicalOr(21)
should return "Outside"");'
+ testString: assert(testLogicalOr(21) === "Outside");
- text: testLogicalOr(25)
应返回“Outside”
- testString: 'assert(testLogicalOr(25) === "Outside", "testLogicalOr(25)
should return "Outside"");'
+ testString: assert(testLogicalOr(25) === "Outside");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.chinese.md
index f459987bc8..348af920fe 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 具有增强加法的复合赋值
```yml
tests:
- text: a
应该等于15
- testString: 'assert(a === 15, "a
should equal 15
");'
+ testString: assert(a === 15);
- text: b
应该等于26
- testString: 'assert(b === 26, "b
should equal 26
");'
+ testString: assert(b === 26);
- text: c
应该等于19
- testString: 'assert(c === 19, "c
should equal 19
");'
+ testString: assert(c === 19);
- text: 您应该为每个变量使用+=
运算符
- testString: 'assert(code.match(/\+=/g).length === 3, "You should use the +=
operator for each variable");'
+ testString: assert(code.match(/\+=/g).length === 3);
- text: 不要修改行上方的代码
- testString: 'assert(/var a = 3;/.test(code) && /var b = 17;/.test(code) && /var c = 12;/.test(code), "Do not modify the code above the line");'
+ testString: assert(/var a = 3;/.test(code) && /var b = 17;/.test(code) && /var c = 12;/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.chinese.md
index 7a57bfef01..f69e8d0c03 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 具有增广划分的复合赋值
```yml
tests:
- text: a
应该等于4
- testString: 'assert(a === 4, "a
should equal 4
");'
+ testString: assert(a === 4);
- text: b
应该等于27
- testString: 'assert(b === 27, "b
should equal 27
");'
+ testString: assert(b === 27);
- text: c
应该等于3
- testString: 'assert(c === 3, "c
should equal 3
");'
+ testString: assert(c === 3);
- text: 您应该为每个变量使用/=
运算符
- testString: 'assert(code.match(/\/=/g).length === 3, "You should use the /=
operator for each variable");'
+ testString: assert(code.match(/\/=/g).length === 3);
- text: 不要修改行上方的代码
- testString: 'assert(/var a = 48;/.test(code) && /var b = 108;/.test(code) && /var c = 33;/.test(code), "Do not modify the code above the line");'
+ testString: assert(/var a = 48;/.test(code) && /var b = 108;/.test(code) && /var c = 33;/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.chinese.md
index 7e92bf1f52..583e18c29f 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 具有增广乘法的复合赋值
```yml
tests:
- text: a
应该等于25
- testString: 'assert(a === 25, "a
should equal 25
");'
+ testString: assert(a === 25);
- text: b
应该等于36
- testString: 'assert(b === 36, "b
should equal 36
");'
+ testString: assert(b === 36);
- text: c
应该等于46
- testString: 'assert(c === 46, "c
should equal 46
");'
+ testString: assert(c === 46);
- text: 您应该为每个变量使用*=
运算符
- testString: 'assert(code.match(/\*=/g).length === 3, "You should use the *=
operator for each variable");'
+ testString: assert(code.match(/\*=/g).length === 3);
- text: 不要修改行上方的代码
- testString: 'assert(/var a = 5;/.test(code) && /var b = 12;/.test(code) && /var c = 4\.6;/.test(code), "Do not modify the code above the line");'
+ testString: assert(/var a = 5;/.test(code) && /var b = 12;/.test(code) && /var c = 4\.6;/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.chinese.md
index 1bf7c7d3a8..2289d1311b 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 具有增广减法的复合赋值
```yml
tests:
- text: a
应该等于5
- testString: 'assert(a === 5, "a
should equal 5
");'
+ testString: assert(a === 5);
- text: b
应该等于-6
- testString: 'assert(b === -6, "b
should equal -6
");'
+ testString: assert(b === -6);
- text: c
应该等于2
- testString: 'assert(c === 2, "c
should equal 2
");'
+ testString: assert(c === 2);
- text: 您应该为每个变量使用-=
运算符
- testString: 'assert(code.match(/-=/g).length === 3, "You should use the -=
operator for each variable");'
+ testString: assert(code.match(/-=/g).length === 3);
- text: 不要修改行上方的代码
- testString: 'assert(/var a = 11;/.test(code) && /var b = 9;/.test(code) && /var c = 3;/.test(code), "Do not modify the code above the line");'
+ testString: assert(/var a = 11;/.test(code) && /var b = 9;/.test(code) && /var c = 3;/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.chinese.md
index 0e1f6b5ff2..99b93de881 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 用Plus运算符连接字符串
```yml
tests:
- text: myStr
应该有一个值This is the start. This is the end.
- testString: 'assert(myStr === "This is the start. This is the end.", "myStr
should have a value of This is the start. This is the end.
");'
+ testString: assert(myStr === "This is the start. This is the end.");
- text: 使用+
运算符构建myStr
- testString: 'assert(code.match(/([""]).*([""])\s*\+\s*([""]).*([""])/g).length > 1, "Use the +
operator to build myStr
");'
+ testString: assert(code.match(/(["']).*(["'])\s*\+\s*(["']).*(["'])/g).length > 1);
- text: 应使用var
关键字创建myStr
。
- testString: 'assert(/var\s+myStr/.test(code), "myStr
should be created using the var
keyword.");'
+ testString: assert(/var\s+myStr/.test(code));
- text: 确保将结果分配给myStr
变量。
- testString: 'assert(/myStr\s*=/.test(code), "Make sure to assign the result to the myStr
variable.");'
+ testString: assert(/myStr\s*=/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.chinese.md
index b2d65800df..3b410131d2 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用Plus Equals运算符连接字符串
```yml
tests:
- text: myStr
应该有一个值This is the first sentence. This is the second sentence.
- testString: 'assert(myStr === "This is the first sentence. This is the second sentence.", "myStr
should have a value of This is the first sentence. This is the second sentence.
");'
+ testString: assert(myStr === "This is the first sentence. This is the second sentence.");
- text: 使用+=
运算符构建myStr
- testString: 'assert(code.match(/\w\s*\+=\s*[""]/g).length > 1 && code.match(/\w\s*\=\s*[""]/g).length > 1, "Use the +=
operator to build myStr
");'
+ testString: assert(code.match(/\w\s*\+=\s*["']/g).length > 1 && code.match(/\w\s*\=\s*["']/g).length > 1);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.chinese.md
index 685933da4e..086ef3571e 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 用变量构造字符串
```yml
tests:
- text: myName
应设置为至少3个字符长的字符串
- testString: 'assert(typeof myName !== "undefined" && myName.length > 2, "myName
should be set to a string at least 3 characters long");'
+ testString: assert(typeof myName !== 'undefined' && myName.length > 2);
- text: 使用两个+
运算符在其中构建myStr
with myName
- testString: 'assert(code.match(/[""]\s*\+\s*myName\s*\+\s*[""]/g).length > 0, "Use two +
operators to build myStr
with myName
inside it");'
+ testString: assert(code.match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.chinese.md
index 4e8a14b611..366c5af36b 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 用For循环向后计数
```yml
tests:
- text: 你应该为此使用for
循环。
- testString: 'assert(code.match(/for\s*\(/g).length > 1, "You should be using a for
loop for this.");'
+ testString: assert(code.match(/for\s*\(/g).length > 1);
- text: 你应该使用数组方法push
。
- testString: 'assert(code.match(/myArray.push/), "You should be using the array method push
.");'
+ testString: assert(code.match(/myArray.push/));
- text: 'myArray
应该等于[9,7,5,3,1]
。'
- testString: 'assert.deepEqual(myArray, [9,7,5,3,1], "myArray
should equal [9,7,5,3,1]
.");'
+ testString: assert.deepEqual(myArray, [9,7,5,3,1]);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.chinese.md
index a40ac2f05d..e9f7724c89 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.chinese.md
@@ -19,19 +19,19 @@ localeTitle: 计数卡
```yml
tests:
- text: 牌序列5 Bet
应该返回5 Bet
- testString: 'assert((function(){ count = 0; cc(2);cc(3);cc(4);cc(5);var out = cc(6); if(out === "5 Bet") {return true;} return false; })(), "Cards Sequence 2, 3, 4, 5, 6 should return 5 Bet
");'
+ testString: assert((function(){ count = 0; cc(2);cc(3);cc(4);cc(5);var out = cc(6); if(out === "5 Bet") {return true;} return false; })());
- text: '卡片序列7,8,9应返回0 Hold
'
- testString: 'assert((function(){ count = 0; cc(7);cc(8);var out = cc(9); if(out === "0 Hold") {return true;} return false; })(), "Cards Sequence 7, 8, 9 should return 0 Hold
");'
+ testString: assert((function(){ count = 0; cc(7);cc(8);var out = cc(9); if(out === "0 Hold") {return true;} return false; })());
- text: 卡序列10,J,Q,K,A应返回-5 Hold
- testString: 'assert((function(){ count = 0; cc(10);cc("J");cc("Q");cc("K");var out = cc("A"); if(out === "-5 Hold") {return true;} return false; })(), "Cards Sequence 10, J, Q, K, A should return -5 Hold
");'
+ testString: assert((function(){ count = 0; cc(10);cc('J');cc('Q');cc('K');var out = cc('A'); if(out === "-5 Hold") {return true;} return false; })());
- text: '卡序列3,7,Q,8,A应返回-1 Hold
'
- testString: 'assert((function(){ count = 0; cc(3);cc(7);cc("Q");cc(8);var out = cc("A"); if(out === "-1 Hold") {return true;} return false; })(), "Cards Sequence 3, 7, Q, 8, A should return -1 Hold
");'
+ testString: assert((function(){ count = 0; cc(3);cc(7);cc('Q');cc(8);var out = cc('A'); if(out === "-1 Hold") {return true;} return false; })());
- text: 牌序列2,J, 1 Bet
应该返回1 Bet
- testString: 'assert((function(){ count = 0; cc(2);cc("J");cc(9);cc(2);var out = cc(7); if(out === "1 Bet") {return true;} return false; })(), "Cards Sequence 2, J, 9, 2, 7 should return 1 Bet
");'
+ testString: assert((function(){ count = 0; cc(2);cc('J');cc(9);cc(2);var out = cc(7); if(out === "1 Bet") {return true;} return false; })());
- text: 牌序列1 Bet
应该返回1 Bet
- testString: 'assert((function(){ count = 0; cc(2);cc(2);var out = cc(10); if(out === "1 Bet") {return true;} return false; })(), "Cards Sequence 2, 2, 10 should return 1 Bet
");'
+ testString: assert((function(){ count = 0; cc(2);cc(2);var out = cc(10); if(out === "1 Bet") {return true;} return false; })());
- text: '卡序列3,2,A,10,K应返回-1 Hold
'
- testString: 'assert((function(){ count = 0; cc(3);cc(2);cc("A");cc(10);var out = cc("K"); if(out === "-1 Hold") {return true;} return false; })(), "Cards Sequence 3, 2, A, 10, K should return -1 Hold
");'
+ testString: assert((function(){ count = 0; cc(3);cc(2);cc('A');cc(10);var out = cc('K'); if(out === "-1 Hold") {return true;} return false; })());
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.chinese.md
index c1c4d8aecc..3a5c4a4313 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用JavaScript创建十进制数
```yml
tests:
- text: myDecimal
应该是一个数字。
- testString: 'assert(typeof myDecimal === "number", "myDecimal
should be a number.");'
+ testString: assert(typeof myDecimal === "number");
- text: myDecimal
应该有一个小数点
- testString: 'assert(myDecimal % 1 != 0, "myDecimal
should have a decimal point"); '
+ testString: assert(myDecimal % 1 != 0);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.chinese.md
index a4a5a34a26..3d9aafaef2 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.chinese.md
@@ -18,7 +18,7 @@ localeTitle: 声明JavaScript变量
```yml
tests:
- text: 您应该使用var
关键字声明myName
,以分号结尾
- testString: 'assert(/var\s+myName\s*;/.test(code), "You should declare myName
with the var
keyword, ending with a semicolon");'
+ testString: assert(/var\s+myName\s*;/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-string-variables.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-string-variables.chinese.md
index bcb8ddfcc4..568e3153af 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-string-variables.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-string-variables.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 声明字符串变量
```yml
tests:
- text: myFirstName
应该是一个至少包含一个字符的字符串。
- testString: 'assert((function(){if(typeof myFirstName !== "undefined" && typeof myFirstName === "string" && myFirstName.length > 0){return true;}else{return false;}})(), "myFirstName
should be a string with at least one character in it.");'
+ testString: assert((function(){if(typeof myFirstName !== "undefined" && typeof myFirstName === "string" && myFirstName.length > 0){return true;}else{return false;}})());
- text: myLastName
应该是一个至少包含一个字符的字符串。
- testString: 'assert((function(){if(typeof myLastName !== "undefined" && typeof myLastName === "string" && myLastName.length > 0){return true;}else{return false;}})(), "myLastName
should be a string with at least one character in it.");'
+ testString: assert((function(){if(typeof myLastName !== "undefined" && typeof myLastName === "string" && myLastName.length > 0){return true;}else{return false;}})());
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.chinese.md
index 966e69642b..c7d2255d46 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 使用JavaScript减少数字
```yml
tests:
- text: myVar
应该等于10
- testString: 'assert(myVar === 10, "myVar
should equal 10
");'
+ testString: assert(myVar === 10);
- text: myVar = myVar - 1;
应该改变
- testString: 'assert(/var\s*myVar\s*=\s*11;\s*\/*.*\s*([-]{2}\s*myVar|myVar\s*[-]{2});/.test(code), "myVar = myVar - 1;
should be changed");'
+ testString: assert(/var\s*myVar\s*=\s*11;\s*\/*.*\s*([-]{2}\s*myVar|myVar\s*[-]{2});/.test(code));
- text: 在myVar
上使用--
运算符
- testString: 'assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code), "Use the --
operator on myVar
");'
+ testString: assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code));
- text: 不要更改行上方的代码
- testString: 'assert(/var myVar = 11;/.test(code), "Do not change code above the line");'
+ testString: assert(/var myVar = 11;/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.chinese.md
index 56731f311b..9d22d5d188 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 从JavaScript对象中删除属性
```yml
tests:
- text: 从myDog
删除属性"tails"
。
- testString: 'assert(typeof myDog === "object" && myDog.tails === undefined, "Delete the property "tails"
from myDog
.");'
+ testString: assert(typeof myDog === "object" && myDog.tails === undefined);
- text: 不要修改myDog
设置
- testString: 'assert(code.match(/"tails": 1/g).length > 1, "Do not modify the myDog
setup");'
+ testString: 'assert(code.match(/"tails": 1/g).length > 1);'
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.chinese.md
index 33e5069361..be6db96555 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 使用JavaScript将另一个十进制除以另一个
```yml
tests:
- text: 变quotient
应该等于2.2
- testString: 'assert(quotient === 2.2, "The variable quotient
should equal 2.2
");'
+ testString: assert(quotient === 2.2);
- text: 您应该使用/
运算符将4.4除以2
- testString: 'assert(/4\.40*\s*\/\s*2\.*0*/.test(code), "You should use the /
operator to divide 4.4 by 2");'
+ testString: assert(/4\.40*\s*\/\s*2\.*0*/.test(code));
- text: 商数变量只应分配一次
- testString: 'assert(code.match(/quotient/g).length === 1, "The quotient variable should only be assigned once");'
+ testString: assert(code.match(/quotient/g).length === 1);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.chinese.md
index 8484a9bd01..d58a9c4db0 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 用JavaScript划分一个号码
```yml
tests:
- text: 使变量quotient
等于2。
- testString: 'assert(quotient === 2, "Make the variable quotient
equal to 2.");'
+ testString: assert(quotient === 2);
- text: 使用/
运算符
- testString: 'assert(/\d+\s*\/\s*\d+/.test(code), "Use the /
operator");'
+ testString: assert(/\d+\s*\/\s*\d+/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.chinese.md
index 6399fb8021..23023ad4b3 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 逃避字符串中的字面引用
```yml
tests:
- text: 您应该使用两个双引号( "
)和四个转义双引号( \"
)。
- testString: 'assert(code.match(/\\"/g).length === 4 && code.match(/[^\\]"/g).length === 2, "You should use two double quotes ("
) and four escaped double quotes (\"
).");'
+ testString: assert(code.match(/\\"/g).length === 4 && code.match(/[^\\]"/g).length === 2);
- text: 变量myStr应该包含字符串: I am a "double quoted" string inside "double quotes".
- testString: 'assert(myStr === "I am a \"double quoted\" string inside \"double quotes\".", "Variable myStr should contain the string: I am a "double quoted" string inside "double quotes".
");'
+ testString: 'assert(myStr === "I am a \"double quoted\" string inside \"double quotes\".");'
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.chinese.md
index a61dcd8174..2dd74e1eeb 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 在JavaScript中查找剩余内容
```yml
tests:
- text: 应该初始化变量remainder
- testString: 'assert(/var\s+?remainder/.test(code), "The variable remainder
should be initialized");'
+ testString: assert(/var\s+?remainder/.test(code));
- text: remainder
的值应为2
- testString: 'assert(remainder === 2, "The value of remainder
should be 2
");'
+ testString: assert(remainder === 2);
- text: 您应该使用%
运算符
- testString: 'assert(/\s+?remainder\s*?=\s*?.*%.*;/.test(code), "You should use the %
operator");'
+ testString: assert(/\s+?remainder\s*?=\s*?.*%.*;/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.chinese.md
index 5a22cca32c..0718a55b69 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 使用JavaScript生成随机分数
```yml
tests:
- text: randomFraction
应该返回一个随机数。
- testString: 'assert(typeof randomFraction() === "number", "randomFraction
should return a random number.");'
+ testString: assert(typeof randomFraction() === "number");
- text: randomFraction
返回的randomFraction
应该是小数。
- testString: 'assert((randomFraction()+""). match(/\./g), "The number returned by randomFraction
should be a decimal.");'
+ testString: assert((randomFraction()+''). match(/\./g));
- text: 您应该使用Math.random
来生成随机十进制数。
- testString: 'assert(code.match(/Math\.random/g).length >= 0, "You should be using Math.random
to generate the random decimal number.");'
+ testString: assert(code.match(/Math\.random/g).length >= 0);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.chinese.md
index 45790d3fd2..aab74f7602 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 使用JavaScript生成随机整数
```yml
tests:
- text: randomWholeNum
的结果应该是整数。
- testString: 'assert(typeof randomWholeNum() === "number" && (function(){var r = randomWholeNum();return Math.floor(r) === r;})(), "The result of randomWholeNum
should be a whole number.");'
+ testString: assert(typeof randomWholeNum() === "number" && (function(){var r = randomWholeNum();return Math.floor(r) === r;})());
- text: 您应该使用Math.random
来生成随机数。
- testString: 'assert(code.match(/Math.random/g).length > 1, "You should be using Math.random
to generate a random number.");'
+ testString: assert(code.match(/Math.random/g).length > 1);
- text: 您应该将Math.random
的结果乘以10,使其成为介于0和9之间的数字。
- testString: 'assert(code.match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || code.match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g), "You should have multiplied the result of Math.random
by 10 to make it a number that is between zero and nine.");'
+ testString: assert(code.match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || code.match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g));
- text: 您应该使用Math.floor
删除数字的小数部分。
- testString: 'assert(code.match(/Math.floor/g).length > 1, "You should use Math.floor
to remove the decimal part of the number.");'
+ testString: assert(code.match(/Math.floor/g).length > 1);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.chinese.md
index 08861d2256..bb25b72917 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 生成范围内的随机整数
```yml
tests:
- text: randomRange
可以生成的最低随机数应该等于你的最小数量myMin
。
- testString: 'assert(calcMin === 5, "The lowest random number that can be generated by randomRange
should be equal to your minimum number, myMin
.");'
+ testString: assert(calcMin === 5);
- text: randomRange
可以生成的最高随机数应该等于最大数量myMax
。
- testString: 'assert(calcMax === 15, "The highest random number that can be generated by randomRange
should be equal to your maximum number, myMax
.");'
+ testString: assert(calcMax === 15);
- text: randomRange
生成的随机数应该是整数,而不是小数。
- testString: 'assert(randomRange(0,1) % 1 === 0 , "The random number generated by randomRange
should be an integer, not a decimal.");'
+ testString: assert(randomRange(0,1) % 1 === 0 );
- text: randomRange
应该同时使用myMax
和myMin
,并在你的范围内返回一个随机数。
- testString: 'assert((function(){if(code.match(/myMax/g).length > 1 && code.match(/myMin/g).length > 2 && code.match(/Math.floor/g) && code.match(/Math.random/g)){return true;}else{return false;}})(), "randomRange
should use both myMax
and myMin
, and return a random number in your range.");'
+ testString: assert((function(){if(code.match(/myMax/g).length > 1 && code.match(/myMin/g).length > 2 && code.match(/Math.floor/g) && code.match(/Math.random/g)){return true;}else{return false;}})());
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.chinese.md
index 68747efee7..23966be58e 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 全球范围和职能
```yml
tests:
- text: 应该定义myGlobal
- testString: 'assert(typeof myGlobal != "undefined", "myGlobal
should be defined");'
+ testString: assert(typeof myGlobal != "undefined");
- text: myGlobal
的值应为10
- testString: 'assert(myGlobal === 10, "myGlobal
should have a value of 10
");'
+ testString: assert(myGlobal === 10);
- text: 应使用var
关键字声明myGlobal
- testString: 'assert(/var\s+myGlobal/.test(code), "myGlobal
should be declared using the var
keyword");'
+ testString: assert(/var\s+myGlobal/.test(code));
- text: oopsGlobal
应该是一个全局变量,其值为5
- testString: 'assert(typeof oopsGlobal != "undefined" && oopsGlobal === 5, "oopsGlobal
should be a global variable and have a value of 5
");'
+ testString: assert(typeof oopsGlobal != "undefined" && oopsGlobal === 5);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.chinese.md
index 5876ce11c6..eae7118a27 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 功能中的全局与局部范围
```yml
tests:
- text: 不要更改全局outerWear
的值
- testString: 'assert(outerWear === "T-Shirt", "Do not change the value of the global outerWear
");'
+ testString: assert(outerWear === "T-Shirt");
- text: myOutfit
应该返回"sweater"
- testString: 'assert(myOutfit() === "sweater", "myOutfit
should return "sweater"
");'
+ testString: assert(myOutfit() === "sweater");
- text: 不要更改return语句
- testString: 'assert(/return outerWear/.test(code), "Do not change the return statement");'
+ testString: assert(/return outerWear/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.chinese.md
index 4c72aea56d..d5ff092f53 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.chinese.md
@@ -19,27 +19,27 @@ localeTitle: 高尔夫码
```yml
tests:
- text: 'golfScore(4, 1)
应该返回“Hole-in-one!”'
- testString: 'assert(golfScore(4, 1) === "Hole-in-one!", "golfScore(4, 1)
should return "Hole-in-one!"");'
+ testString: assert(golfScore(4, 1) === "Hole-in-one!");
- text: 'golfScore(4, 2)
应该返回“Eagle”'
- testString: 'assert(golfScore(4, 2) === "Eagle", "golfScore(4, 2)
should return "Eagle"");'
+ testString: assert(golfScore(4, 2) === "Eagle");
- text: 'golfScore(5, 2)
应该返回“Eagle”'
- testString: 'assert(golfScore(5, 2) === "Eagle", "golfScore(5, 2)
should return "Eagle"");'
+ testString: assert(golfScore(5, 2) === "Eagle");
- text: 'golfScore(4, 3)
应该返回“Birdie”'
- testString: 'assert(golfScore(4, 3) === "Birdie", "golfScore(4, 3)
should return "Birdie"");'
+ testString: assert(golfScore(4, 3) === "Birdie");
- text: 'golfScore(4, 4)
应该返回“Par”'
- testString: 'assert(golfScore(4, 4) === "Par", "golfScore(4, 4)
should return "Par"");'
+ testString: assert(golfScore(4, 4) === "Par");
- text: 'golfScore(1, 1)
应该返回“Hole-in-one!”'
- testString: 'assert(golfScore(1, 1) === "Hole-in-one!", "golfScore(1, 1)
should return "Hole-in-one!"");'
+ testString: assert(golfScore(1, 1) === "Hole-in-one!");
- text: 'golfScore(5, 5)
应该返回“Par”'
- testString: 'assert(golfScore(5, 5) === "Par", "golfScore(5, 5)
should return "Par"");'
+ testString: assert(golfScore(5, 5) === "Par");
- text: 'golfScore(4, 5)
应该返回“Bogey”'
- testString: 'assert(golfScore(4, 5) === "Bogey", "golfScore(4, 5)
should return "Bogey"");'
+ testString: assert(golfScore(4, 5) === "Bogey");
- text: 'golfScore(4, 6)
应该返回“Double Bogey”'
- testString: 'assert(golfScore(4, 6) === "Double Bogey", "golfScore(4, 6)
should return "Double Bogey"");'
+ testString: assert(golfScore(4, 6) === "Double Bogey");
- text: 'golfScore(4, 7)
应该返回“Go Home!”'
- testString: 'assert(golfScore(4, 7) === "Go Home!", "golfScore(4, 7)
should return "Go Home!"");'
+ testString: assert(golfScore(4, 7) === "Go Home!");
- text: 'golfScore(5, 9)
应该返回“Go Home!”'
- testString: 'assert(golfScore(5, 9) === "Go Home!", "golfScore(5, 9)
should return "Go Home!"");'
+ testString: assert(golfScore(5, 9) === "Go Home!");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.chinese.md
index f85bcf09b8..a7340239eb 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 使用JavaScript增加数字
```yml
tests:
- text: myVar
应该等于88
- testString: 'assert(myVar === 88, "myVar
should equal 88
");'
+ testString: assert(myVar === 88);
- text: myVar = myVar + 1;
应该改变
- testString: 'assert(/var\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2});/.test(code), "myVar = myVar + 1;
should be changed");'
+ testString: assert(/var\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2});/.test(code));
- text: 使用++
运算符
- testString: 'assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code), "Use the ++
operator");'
+ testString: assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code));
- text: 不要更改行上方的代码
- testString: 'assert(/var myVar = 87;/.test(code), "Do not change code above the line");'
+ testString: assert(/var myVar = 87;/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.chinese.md
index fba0af0a67..77009e8f51 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.chinese.md
@@ -18,7 +18,7 @@ localeTitle: 使用赋值运算符初始化变量
```yml
tests:
- text: 将a
初始化为值9
- testString: 'assert(/var\s+a\s*=\s*9\s*/.test(code), "Initialize a
to a value of 9
");'
+ testString: assert(/var\s+a\s*=\s*9\s*/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.chinese.md
index d488fbc10f..3ce0c57dae 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.chinese.md
@@ -18,21 +18,21 @@ localeTitle: 如果声明引入Else
```yml
tests:
- text: 你应该至少有两个else
语句
- testString: 'assert(code.match(/else/g).length > 1, "You should have at least two else
statements");'
+ testString: assert(code.match(/else/g).length > 1);
- text: 你应该至少有两个if
语句
- testString: 'assert(code.match(/if/g).length > 1, "You should have at least two if
statements");'
+ testString: assert(code.match(/if/g).length > 1);
- text: 您应该为每个条件关闭并打开花括号
- testString: 'assert(code.match(/if\s*\((.+)\)\s*\{[\s\S]+\}\s*else if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s*\{[\s\S]+\s*\}/), "You should have closing and opening curly braces for each condition in your if else statement");'
+ testString: assert(code.match(/if\s*\((.+)\)\s*\{[\s\S]+\}\s*else if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s*\{[\s\S]+\s*\}/));
- text: testElseIf(0)
应返回“小于5”
- testString: 'assert(testElseIf(0) === "Smaller than 5", "testElseIf(0)
should return "Smaller than 5"");'
+ testString: assert(testElseIf(0) === "Smaller than 5");
- text: testElseIf(5)
应该返回“5到10之间”
- testString: 'assert(testElseIf(5) === "Between 5 and 10", "testElseIf(5)
should return "Between 5 and 10"");'
+ testString: assert(testElseIf(5) === "Between 5 and 10");
- text: testElseIf(7)
应返回“5到10之间”
- testString: 'assert(testElseIf(7) === "Between 5 and 10", "testElseIf(7)
should return "Between 5 and 10"");'
+ testString: assert(testElseIf(7) === "Between 5 and 10");
- text: testElseIf(10)
应返回“5到10之间”
- testString: 'assert(testElseIf(10) === "Between 5 and 10", "testElseIf(10)
should return "Between 5 and 10"");'
+ testString: assert(testElseIf(10) === "Between 5 and 10");
- text: testElseIf(12)
应返回“大于10”
- testString: 'assert(testElseIf(12) === "Greater than 10", "testElseIf(12)
should return "Greater than 10"");'
+ testString: assert(testElseIf(12) === "Greater than 10");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.chinese.md
index 71fb7747a8..06e9d3777e 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.chinese.md
@@ -18,19 +18,19 @@ localeTitle: 介绍其他声明
```yml
tests:
- text: 您应该只在编辑器中有一个if
语句
- testString: 'assert(code.match(/if/g).length === 1, "You should only have one if
statement in the editor");'
+ testString: assert(code.match(/if/g).length === 1);
- text: 你应该使用else
语句
- testString: 'assert(/else/g.test(code), "You should use an else
statement");'
+ testString: assert(/else/g.test(code));
- text: testElse(4)
应返回“5或更小”
- testString: 'assert(testElse(4) === "5 or Smaller", "testElse(4)
should return "5 or Smaller"");'
+ testString: assert(testElse(4) === "5 or Smaller");
- text: testElse(5)
应返回“5或更小”
- testString: 'assert(testElse(5) === "5 or Smaller", "testElse(5)
should return "5 or Smaller"");'
+ testString: assert(testElse(5) === "5 or Smaller");
- text: testElse(6)
应该返回“大于5”
- testString: 'assert(testElse(6) === "Bigger than 5", "testElse(6)
should return "Bigger than 5"");'
+ testString: assert(testElse(6) === "Bigger than 5");
- text: testElse(10)
应该返回“大于5”
- testString: 'assert(testElse(10) === "Bigger than 5", "testElse(10)
should return "Bigger than 5"");'
+ testString: assert(testElse(10) === "Bigger than 5");
- text: 请勿更改行上方或下方的代码。
- testString: 'assert(/var result = "";/.test(code) && /return result;/.test(code), "Do not change the code above or below the lines.");'
+ testString: assert(/var result = "";/.test(code) && /return result;/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.chinese.md
index b0a7ebafef..ba40fce4d9 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用For循环迭代奇数
```yml
tests:
- text: 你应该为此使用for
循环。
- testString: 'assert(code.match(/for\s*\(/g).length > 1, "You should be using a for
loop for this.");'
+ testString: assert(code.match(/for\s*\(/g).length > 1);
- text: 'myArray
应该等于[1,3,5,7,9]
。'
- testString: 'assert.deepEqual(myArray, [1,3,5,7,9], "myArray
should equal [1,3,5,7,9]
.");'
+ testString: assert.deepEqual(myArray, [1,3,5,7,9]);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.chinese.md
index 5a364324a7..8485e9cf9b 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 使用For循环遍历数组
```yml
tests:
- text: 应声明total
并初始化为0
- testString: 'assert(code.match(/var.*?total\s*=\s*0.*?;/), "total
should be declared and initialized to 0");'
+ testString: assert(code.match(/(var|let|const)\s*?total\s*=\s*0.*?;?/));
- text: total
应该等于20
- testString: 'assert(total === 20, "total
should equal 20");'
+ testString: assert(total === 20);
- text: 您应该使用for
循环来遍历myArr
- testString: 'assert(code.match(/for\s*\(/g).length > 1 && code.match(/myArr\s*\[/), "You should use a for
loop to iterate through myArr
");'
+ testString: assert(code.match(/for\s*\(/g).length > 1 && code.match(/myArr\s*\[/));
- text: 不要直接将total
设置为20
- testString: 'assert(!code.match(/total[\s\+\-]*=\s*(\d(?!\s*[;,])|[1-9])/g), "Do not set total
to 20 directly");'
+ testString: assert(!code.replace(/\s/g, '').match(/total[=+-]0*[1-9]+/gm));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.chinese.md
index 6d371eba9a..980fa1df66 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 使用JavaScript迭代...循环
```yml
tests:
- text: 你应该使用do...while
循环。
- testString: 'assert(code.match(/do/g), "You should be using a do...while
loop for this.");'
+ testString: assert(code.match(/do/g));
- text: 'myArray
应该等于[10]
。'
- testString: 'assert.deepEqual(myArray, [10], "myArray
should equal [10]
.");'
+ testString: assert.deepEqual(myArray, [10]);
- text: i
应该等于11
- testString: 'assert.deepEqual(i, 11, "i
should equal 11
");'
+ testString: assert.equal(i, 11);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.chinese.md
index 24d62d55b6..cfa0d6e543 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用JavaScript迭代循环
```yml
tests:
- text: 你应该为此使用for
循环。
- testString: 'assert(code.match(/for\s*\(/g).length > 1, "You should be using a for
loop for this.");'
+ testString: assert(code.match(/for\s*\(/g).length > 1);
- text: 'myArray
应该等于[1,2,3,4,5]
。'
- testString: 'assert.deepEqual(myArray, [1,2,3,4,5], "myArray
should equal [1,2,3,4,5]
.");'
+ testString: assert.deepEqual(myArray, [1,2,3,4,5]);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.chinese.md
index 071f65451b..c290a98a51 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 在循环时使用JavaScript进行迭代
```yml
tests:
- text: 你应该使用while
循环。
- testString: 'assert(code.match(/while/g), "You should be using a while
loop for this.");'
+ testString: assert(code.match(/while/g));
- text: 'myArray
应该等于[0,1,2,3,4]
。'
- testString: 'assert.deepEqual(myArray, [0,1,2,3,4], "myArray
should equal [0,1,2,3,4]
.");'
+ testString: assert.deepEqual(myArray, [5,4,3,2,1,0]);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.chinese.md
index f6b6821760..716bdb4cf9 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 本地范围和功能
```yml
tests:
- text: 没有全局myVar
变量
- testString: 'assert(typeof myVar === "undefined", "No global myVar
variable");'
+ testString: assert(typeof myVar === 'undefined');
- text: 添加本地myVar
变量
- testString: 'assert(/var\s+myVar/.test(code), "Add a local myVar
variable");'
+ testString: assert(/function\s+myLocalScope\s*\(\s*\)\s*\{\s[\s\S]+\s*var\s*myVar\s*(\s*|=[\s\S]+)\s*;[\s\S]+}/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/logical-order-in-if-else-statements.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/logical-order-in-if-else-statements.chinese.md
index 374e397cde..0fd60a9eb6 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/logical-order-in-if-else-statements.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/logical-order-in-if-else-statements.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 如果其他陈述中的逻辑顺序
```yml
tests:
- text: orderMyLogic(4)
应返回“小于5”
- testString: 'assert(orderMyLogic(4) === "Less than 5", "orderMyLogic(4)
should return "Less than 5"");'
+ testString: assert(orderMyLogic(4) === "Less than 5");
- text: orderMyLogic(6)
应该返回“少于10”
- testString: 'assert(orderMyLogic(6) === "Less than 10", "orderMyLogic(6)
should return "Less than 10"");'
+ testString: assert(orderMyLogic(6) === "Less than 10");
- text: orderMyLogic(11)
应该返回“大于或等于10”
- testString: 'assert(orderMyLogic(11) === "Greater than or equal to 10", "orderMyLogic(11)
should return "Greater than or equal to 10"");'
+ testString: assert(orderMyLogic(11) === "Greater than or equal to 10");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.chinese.md
index 4685b553bc..09d273bc9c 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 使用pop()操作数组
```yml
tests:
- text: 'myArray
应该只包含[["John", 23]]
。'
- testString: 'assert((function(d){if(d[0][0] == "John" && d[0][1] === 23 && d[1] == undefined){return true;}else{return false;}})(myArray), "myArray
should only contain [["John", 23]]
.");'
+ testString: assert((function(d){if(d[0][0] == 'John' && d[0][1] === 23 && d[1] == undefined){return true;}else{return false;}})(myArray));
- text: 在myArray
上使用pop()
- testString: 'assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code), "Use pop()
on myArray
");'
+ testString: assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code));
- text: 'removedFromMyArray
应该只包含["cat", 2]
。'
- testString: 'assert((function(d){if(d[0] == "cat" && d[1] === 2 && d[2] == undefined){return true;}else{return false;}})(removedFromMyArray), "removedFromMyArray
should only contain ["cat", 2]
.");'
+ testString: assert((function(d){if(d[0] == 'cat' && d[1] === 2 && d[2] == undefined){return true;}else{return false;}})(removedFromMyArray));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.chinese.md
index ba40b408bf..52f5820ab0 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.chinese.md
@@ -18,7 +18,7 @@ localeTitle: 用push()操纵数组
```yml
tests:
- text: 'myArray
现在应该等于[["John", 23], ["cat", 2], ["dog", 3]]
。'
- testString: 'assert((function(d){if(d[2] != undefined && d[0][0] == "John" && d[0][1] === 23 && d[2][0] == "dog" && d[2][1] === 3 && d[2].length == 2){return true;}else{return false;}})(myArray), "myArray
should now equal [["John", 23], ["cat", 2], ["dog", 3]]
.");'
+ testString: assert((function(d){if(d[2] != undefined && d[0][0] == 'John' && d[0][1] === 23 && d[2][0] == 'dog' && d[2][1] === 3 && d[2].length == 2){return true;}else{return false;}})(myArray));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-shift.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-shift.chinese.md
index 0c50ecce65..1e9876e475 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-shift.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-shift.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用shift()操纵数组
```yml
tests:
- text: 'myArray
现在应该等于[["dog", 3]]
。'
- testString: 'assert((function(d){if(d[0][0] == "dog" && d[0][1] === 3 && d[1] == undefined){return true;}else{return false;}})(myArray), "myArray
should now equal [["dog", 3]]
.");'
+ testString: assert((function(d){if(d[0][0] == 'dog' && d[0][1] === 3 && d[1] == undefined){return true;}else{return false;}})(myArray));
- text: 'removedFromMyArray
应该包含["John", 23]
。'
- testString: 'assert((function(d){if(d[0] == "John" && d[1] === 23 && typeof removedFromMyArray === "object"){return true;}else{return false;}})(removedFromMyArray), "removedFromMyArray
should contain ["John", 23]
.");'
+ testString: assert((function(d){if(d[0] == 'John' && d[1] === 23 && typeof removedFromMyArray === 'object'){return true;}else{return false;}})(removedFromMyArray));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.chinese.md
index 4721a711ce..d96fb44e18 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.chinese.md
@@ -18,7 +18,7 @@ localeTitle: 使用unshift操作数组()
```yml
tests:
- text: 'myArray
现在应该有[[“Paul”,35],[“dog”,3]]。'
- testString: '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), "myArray
should now have [["Paul", 35], ["dog", 3]].");'
+ testString: 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));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.chinese.md
index f5cec9c525..8e6f2e2152 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.chinese.md
@@ -18,23 +18,23 @@ localeTitle: 操纵复杂对象
```yml
tests:
- text: myMusic
应该是一个数组
- testString: 'assert(Array.isArray(myMusic), "myMusic
should be an array");'
+ testString: assert(Array.isArray(myMusic));
- text: myMusic
应该至少有两个元素
- testString: 'assert(myMusic.length > 1, "myMusic
should have at least two elements");'
+ testString: assert(myMusic.length > 1);
- text: 'myMusic[1]
应该是一个对象'
- testString: 'assert(typeof myMusic[1] === "object", "myMusic[1]
should be an object");'
+ testString: assert(typeof myMusic[1] === 'object');
- text: 'myMusic[1]
应该至少有4个属性'
- testString: 'assert(Object.keys(myMusic[1]).length > 3, "myMusic[1]
should have at least 4 properties");'
+ testString: assert(Object.keys(myMusic[1]).length > 3);
- text: 'myMusic[1]
应该包含一个artist
属性,它是一个字符串'
- testString: 'assert(myMusic[1].hasOwnProperty("artist") && typeof myMusic[1].artist === "string", "myMusic[1]
should contain an artist
property which is a string");'
+ testString: assert(myMusic[1].hasOwnProperty('artist') && typeof myMusic[1].artist === 'string');
- text: 'myMusic[1]
应该包含一个title
属性,它是一个字符串'
- testString: 'assert(myMusic[1].hasOwnProperty("title") && typeof myMusic[1].title === "string", "myMusic[1]
should contain a title
property which is a string");'
+ testString: assert(myMusic[1].hasOwnProperty('title') && typeof myMusic[1].title === 'string');
- text: 'myMusic[1]
应该包含一个release_year
属性,它是一个数字'
- testString: 'assert(myMusic[1].hasOwnProperty("release_year") && typeof myMusic[1].release_year === "number", "myMusic[1]
should contain a release_year
property which is a number");'
+ testString: assert(myMusic[1].hasOwnProperty('release_year') && typeof myMusic[1].release_year === 'number');
- text: 'myMusic[1]
应该包含一个formats
属性,它是一个数组'
- testString: 'assert(myMusic[1].hasOwnProperty("formats") && Array.isArray(myMusic[1].formats), "myMusic[1]
should contain a formats
property which is an array");'
+ testString: assert(myMusic[1].hasOwnProperty('formats') && Array.isArray(myMusic[1].formats));
- text: formats
应该是一个至少包含两个元素的字符串数组
- testString: 'assert(myMusic[1].formats.every(function(item) { return (typeof item === "string")}) && myMusic[1].formats.length > 1, "formats
should be an array of strings with at least two elements");'
+ testString: assert(myMusic[1].formats.every(function(item) { return (typeof item === "string")}) && myMusic[1].formats.length > 1);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.chinese.md
index ddf1d50613..8fa94bee2b 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用索引修改数组数据
```yml
tests:
- text: 'myArray
现在应该是[45,64,99]。'
- testString: 'assert((function(){if(typeof myArray != "undefined" && myArray[0] == 45 && myArray[1] == 64 && myArray[2] == 99){return true;}else{return false;}})(), "myArray
should now be [45,64,99].");'
+ testString: assert((function(){if(typeof myArray != 'undefined' && myArray[0] == 45 && myArray[1] == 64 && myArray[2] == 99){return true;}else{return false;}})());
- text: 您应该使用正确的索引来修改myArray
的值。
- testString: 'assert((function(){if(code.match(/myArray\[0\]\s*=\s*/g)){return true;}else{return false;}})(), "You should be using correct index to modify the value in myArray
.");'
+ testString: assert((function(){if(code.match(/myArray\[0\]\s*=\s*/g)){return true;}else{return false;}})());
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.chinese.md
index b0a3fbdda7..078ae74fe9 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.chinese.md
@@ -18,27 +18,27 @@ localeTitle: 交换机语句中的多个相同选项
```yml
tests:
- text: sequentialSizes(1)
应返回“Low”
- testString: 'assert(sequentialSizes(1) === "Low", "sequentialSizes(1)
should return "Low"");'
+ testString: assert(sequentialSizes(1) === "Low");
- text: sequentialSizes(2)
应该返回“Low”
- testString: 'assert(sequentialSizes(2) === "Low", "sequentialSizes(2)
should return "Low"");'
+ testString: assert(sequentialSizes(2) === "Low");
- text: sequentialSizes(3)
应返回“Low”
- testString: 'assert(sequentialSizes(3) === "Low", "sequentialSizes(3)
should return "Low"");'
+ testString: assert(sequentialSizes(3) === "Low");
- text: sequentialSizes(4)
应返回“Mid”
- testString: 'assert(sequentialSizes(4) === "Mid", "sequentialSizes(4)
should return "Mid"");'
+ testString: assert(sequentialSizes(4) === "Mid");
- text: sequentialSizes(5)
应返回“Mid”
- testString: 'assert(sequentialSizes(5) === "Mid", "sequentialSizes(5)
should return "Mid"");'
+ testString: assert(sequentialSizes(5) === "Mid");
- text: sequentialSizes(6)
应返回“Mid”
- testString: 'assert(sequentialSizes(6) === "Mid", "sequentialSizes(6)
should return "Mid"");'
+ testString: assert(sequentialSizes(6) === "Mid");
- text: sequentialSizes(7)
应该返回“High”
- testString: 'assert(sequentialSizes(7) === "High", "sequentialSizes(7)
should return "High"");'
+ testString: assert(sequentialSizes(7) === "High");
- text: sequentialSizes(8)
应该返回“High”
- testString: 'assert(sequentialSizes(8) === "High", "sequentialSizes(8)
should return "High"");'
+ testString: assert(sequentialSizes(8) === "High");
- text: sequentialSizes(9)
应该返回“High”
- testString: 'assert(sequentialSizes(9) === "High", "sequentialSizes(9)
should return "High"");'
+ testString: assert(sequentialSizes(9) === "High");
- text: 您不应该使用任何if
或else
语句
- testString: 'assert(!/else/g.test(code) || !/if/g.test(code), "You should not use any if
or else
statements");'
+ testString: assert(!/else/g.test(code) || !/if/g.test(code));
- text: 你应该有九个case
陈述
- testString: 'assert(code.match(/case/g).length === 9, "You should have nine case
statements");'
+ testString: assert(code.match(/case/g).length === 9);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.chinese.md
index 1b2ec9c606..22d40ee2a4 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用JavaScript乘以两个小数
```yml
tests:
- text: 变量product
应该等于5.0
。
- testString: 'assert(product === 5.0, "The variable product
should equal 5.0
.");'
+ testString: assert(product === 5.0);
- text: 你应该使用*
运算符
- testString: 'assert(/\*/.test(code), "You should use the *
operator");'
+ testString: assert(/\*/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.chinese.md
index 472ffaf397..02bb600a9c 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用JavaScript将两个数字相乘
```yml
tests:
- text: 使变量product
等于80
- testString: 'assert(product === 80,"Make the variable product
equal 80");'
+ testString: assert(product === 80);
- text: 使用*
运算符
- testString: 'assert(/\*/.test(code), "Use the *
operator");'
+ testString: assert(/\*/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.chinese.md
index 3a01fb01aa..ddaab9db87 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.chinese.md
@@ -18,7 +18,7 @@ localeTitle: 将一个Array嵌套在另一个Array中
```yml
tests:
- text: myArray
应至少有一个嵌套在另一个数组中的数组。
- testString: 'assert(Array.isArray(myArray) && myArray.some(Array.isArray), "myArray
should have at least one array nested within another array.");'
+ testString: assert(Array.isArray(myArray) && myArray.some(Array.isArray));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops.chinese.md
index 604597bfe5..ca823e5cb0 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 嵌套循环
```yml
tests:
- text: 'multiplyAll([[1],[2],[3]])
应该返回6
'
- testString: 'assert(multiplyAll([[1],[2],[3]]) === 6, "multiplyAll([[1],[2],[3]])
should return 6
");'
+ testString: assert(multiplyAll([[1],[2],[3]]) === 6);
- text: 'multiplyAll([[1,2],[3,4],[5,6,7]])
应返回5040
'
- testString: 'assert(multiplyAll([[1,2],[3,4],[5,6,7]]) === 5040, "multiplyAll([[1,2],[3,4],[5,6,7]])
should return 5040
");'
+ testString: assert(multiplyAll([[1,2],[3,4],[5,6,7]]) === 5040);
- text: 'multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]])
应该返回54
'
- testString: 'assert(multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]]) === 54, "multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]])
should return 54
");'
+ testString: assert(multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]]) === 54);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.chinese.md
index 9c8bcdd735..8f9e75c58a 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 将值传递给带参数的函数
```yml
tests:
- text: functionWithArgs
应该是一个函数
- testString: 'assert(typeof functionWithArgs === "function", "functionWithArgs
should be a function");'
+ testString: assert(typeof functionWithArgs === 'function');
- text: 'functionWithArgs(1,2)
应该输出3
'
- testString: 'if(typeof functionWithArgs === "function") { capture(); functionWithArgs(1,2); uncapture(); } assert(logOutput == 3, "functionWithArgs(1,2)
should output 3
");'
+ testString: if(typeof functionWithArgs === "function") { capture(); functionWithArgs(1,2); uncapture(); } assert(logOutput == 3);
- text: 'functionWithArgs(7,9)
应该输出16
'
- testString: 'if(typeof functionWithArgs === "function") { capture(); functionWithArgs(7,9); uncapture(); } assert(logOutput == 16, "functionWithArgs(7,9)
should output 16
");'
+ testString: if(typeof functionWithArgs === "function") { capture(); functionWithArgs(7,9); uncapture(); } assert(logOutput == 16);
- text: 定义后,使用两个数字调用functionWithArgs
。
- testString: 'assert(/^\s*functionWithArgs\s*\(\s*\d+\s*,\s*\d+\s*\)\s*;/m.test(code), "Call functionWithArgs
with two numbers after you define it.");'
+ testString: assert(/^\s*functionWithArgs\s*\(\s*\d+\s*,\s*\d+\s*\)\s*/m.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.chinese.md
index 72e0bebd09..7d4a5d1115 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 练习比较不同的值
```yml
tests:
- text: 'compareEquality(10, "10")
应返回“Not Equal”'
- testString: 'assert(compareEquality(10, "10") === "Not Equal", "compareEquality(10, "10")
should return "Not Equal"");'
+ testString: assert(compareEquality(10, "10") === "Not Equal");
- text: 'compareEquality("20", 20)
应该返回“Not Equal”'
- testString: 'assert(compareEquality("20", 20) === "Not Equal", "compareEquality("20", 20)
should return "Not Equal"");'
+ testString: assert(compareEquality("20", 20) === "Not Equal");
- text: 您应该使用===
运算符
- testString: 'assert(code.match(/===/g), "You should use the ===
operator");'
+ testString: assert(code.match(/===/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.chinese.md
index 979d8d03b3..704168125a 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.chinese.md
@@ -19,17 +19,17 @@ localeTitle: 个人资料查询
```yml
tests:
- text: '"Kristian", "lastName"
应该返回"Vos"
'
- testString: 'assert(lookUpProfile("Kristian","lastName") === "Vos", ""Kristian", "lastName"
should return "Vos"
");'
+ testString: assert(lookUpProfile('Kristian','lastName') === "Vos");
- text: '"Sherlock", "likes"
应该回归["Intriguing Cases", "Violin"]
'
- testString: 'assert.deepEqual(lookUpProfile("Sherlock", "likes"), ["Intriguing Cases", "Violin"], ""Sherlock", "likes"
should return ["Intriguing Cases", "Violin"]
");'
+ testString: assert.deepEqual(lookUpProfile("Sherlock", "likes"), ["Intriguing Cases", "Violin"]);
- text: '"Harry","likes"
应该返回一个阵列'
- testString: 'assert(typeof lookUpProfile("Harry", "likes") === "object", ""Harry","likes"
should return an array");'
+ testString: assert(typeof lookUpProfile("Harry", "likes") === "object");
- text: '"Bob", "number"
应该返回“没有这样的联系”'
- testString: 'assert(lookUpProfile("Bob", "number") === "No such contact", ""Bob", "number"
should return "No such contact"");'
+ testString: assert(lookUpProfile("Bob", "number") === "No such contact");
- text: '"Bob", "potato"
应该返回“没有这样的联系”'
- testString: 'assert(lookUpProfile("Bob", "potato") === "No such contact", ""Bob", "potato"
should return "No such contact"");'
+ testString: assert(lookUpProfile("Bob", "potato") === "No such contact");
- text: '"Akira", "address"
应该返回“没有这样的财产”'
- testString: 'assert(lookUpProfile("Akira", "address") === "No such property", ""Akira", "address"
should return "No such property"");'
+ testString: assert(lookUpProfile("Akira", "address") === "No such property");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.chinese.md
index e8f8eb3572..55dfdae64c 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 单引号引用字符串
```yml
tests:
- text: 删除所有backslashes
( \
)
- testString: 'assert(!/\\/g.test(code) && myStr.match("\\s*\\s*Link\\s*\\s*"), "Remove all the backslashes
(\
)");'
+ testString: assert(!/\\/g.test(code) && myStr.match('\\s*\\s*Link\\s*\\s*'));
- text: '你应该有两个单引号'
和四个双引号"
'
- testString: 'assert(code.match(/"/g).length === 4 && code.match(/"/g).length === 2, "You should have two single quotes '
and four double quotes "
");'
+ testString: assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.chinese.md
index d8131a1487..97c47318bb 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.chinese.md
@@ -19,19 +19,19 @@ localeTitle: 记录收集
```yml
tests:
- text: '在updateRecords(5439, "artist", "ABBA")
, artist
应该是"ABBA"
'
- testString: 'collection = collectionCopy; assert(updateRecords(5439, "artist", "ABBA")[5439]["artist"] === "ABBA", "After updateRecords(5439, "artist", "ABBA")
, artist
should be "ABBA"
");'
+ testString: collection = collectionCopy; assert(updateRecords(5439, "artist", "ABBA")[5439]["artist"] === "ABBA");
- text: '在updateRecords(5439, "tracks", "Take a Chance on Me")
, tracks
应该以"Take a Chance on Me"
作为最后一个元素。'
- testString: 'assert(updateRecords(5439, "tracks", "Take a Chance on Me")[5439]["tracks"].pop() === "Take a Chance on Me", "After updateRecords(5439, "tracks", "Take a Chance on Me")
, tracks
should have "Take a Chance on Me"
as the last element.");'
+ testString: assert(updateRecords(5439, "tracks", "Take a Chance on Me")[5439]["tracks"].pop() === "Take a Chance on Me");
- text: '在updateRecords(2548, "artist", "")
,不应该设置artist
'
- testString: 'updateRecords(2548, "artist", ""); assert(!collection[2548].hasOwnProperty("artist"), "After updateRecords(2548, "artist", "")
, artist
should not be set");'
+ testString: updateRecords(2548, "artist", ""); assert(!collection[2548].hasOwnProperty("artist"));
- text: '在updateRecords(1245, "tracks", "Addicted to Love")
, tracks
应该将"Addicted to Love"
作为最后一个元素。'
- testString: 'assert(updateRecords(1245, "tracks", "Addicted to Love")[1245]["tracks"].pop() === "Addicted to Love", "After updateRecords(1245, "tracks", "Addicted to Love")
, tracks
should have "Addicted to Love"
as the last element.");'
+ testString: assert(updateRecords(1245, "tracks", "Addicted to Love")[1245]["tracks"].pop() === "Addicted to Love");
- text: '在updateRecords(2468, "tracks", "Free")
, tracks
应该以"1999"
作为第一个元素。'
- testString: 'assert(updateRecords(2468, "tracks", "Free")[2468]["tracks"][0] === "1999", "After updateRecords(2468, "tracks", "Free")
, tracks
should have "1999"
as the first element.");'
+ testString: assert(updateRecords(2468, "tracks", "Free")[2468]["tracks"][0] === "1999");
- text: '在updateRecords(2548, "tracks", "")
,不应设置tracks
'
- testString: 'updateRecords(2548, "tracks", ""); assert(!collection[2548].hasOwnProperty("tracks"), "After updateRecords(2548, "tracks", "")
, tracks
should not be set");'
+ testString: updateRecords(2548, "tracks", ""); assert(!collection[2548].hasOwnProperty("tracks"));
- text: '在updateRecords(1245, "album", "Riptide")
, album
应该是"Riptide"
'
- testString: 'assert(updateRecords(1245, "album", "Riptide")[1245]["album"] === "Riptide", "After updateRecords(1245, "album", "Riptide")
, album
should be "Riptide"
");'
+ testString: assert(updateRecords(1245, "album", "Riptide")[1245]["album"] === "Riptide");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.chinese.md
index f4bb2bad5f..b2ed9b5541 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.chinese.md
@@ -18,25 +18,25 @@ localeTitle: 如果用交换机替换其他链条
```yml
tests:
- text: 您不应该在编辑器中的任何位置使用任何else
语句
- testString: 'assert(!/else/g.test(code), "You should not use any else
statements anywhere in the editor");'
+ testString: assert(!/else/g.test(code));
- text: 您不应在编辑器中的任何位置使用任何if
语句
- testString: 'assert(!/if/g.test(code), "You should not use any if
statements anywhere in the editor");'
+ testString: assert(!/if/g.test(code));
- text: 你应该至少有四个break
语句
- testString: 'assert(code.match(/break/g).length >= 4, "You should have at least four break
statements");'
+ testString: assert(code.match(/break/g).length >= 4);
- text: chainToSwitch("bob")
应该是“Marley”
- testString: 'assert(chainToSwitch("bob") === "Marley", "chainToSwitch("bob")
should be "Marley"");'
+ testString: assert(chainToSwitch("bob") === "Marley");
- text: chainToSwitch(42)
应该是“答案”
- testString: 'assert(chainToSwitch(42) === "The Answer", "chainToSwitch(42)
should be "The Answer"");'
+ testString: assert(chainToSwitch(42) === "The Answer");
- text: chainToSwitch(1)
应该是“没有#1”
- testString: 'assert(chainToSwitch(1) === "There is no #1", "chainToSwitch(1)
should be "There is no #1"");'
+ testString: "assert(chainToSwitch(1) === \"There is no #1\");"
- text: chainToSwitch(99)
应该是“错过了我这么多!”
- testString: 'assert(chainToSwitch(99) === "Missed me by this much!", "chainToSwitch(99)
should be "Missed me by this much!"");'
+ testString: assert(chainToSwitch(99) === "Missed me by this much!");
- text: chainToSwitch(7)
应该是“Ate Nine”
- testString: 'assert(chainToSwitch(7) === "Ate Nine", "chainToSwitch(7)
should be "Ate Nine"");'
+ testString: assert(chainToSwitch(7) === "Ate Nine");
- text: chainToSwitch("John")
应为“”(空字符串)
- testString: 'assert(chainToSwitch("John") === "", "chainToSwitch("John")
should be "" (empty string)");'
+ testString: assert(chainToSwitch("John") === "");
- text: chainToSwitch(156)
应为“”(空字符串)
- testString: 'assert(chainToSwitch(156) === "", "chainToSwitch(156)
should be "" (empty string)");'
+ testString: assert(chainToSwitch(156) === "");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return.chinese.md
index 9427c9a812..c8127e5900 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 从带返回的函数返回值
```yml
tests:
- text: timesFive
应该是一个功能
- testString: 'assert(typeof timesFive === "function", "timesFive
should be a function");'
+ testString: assert(typeof timesFive === 'function');
- text: timesFive(5)
应该返回25
- testString: 'assert(timesFive(5) === 25, "timesFive(5)
should return 25
");'
+ testString: assert(timesFive(5) === 25);
- text: timesFive(2)
应该返回10
- testString: 'assert(timesFive(2) === 10, "timesFive(2)
should return 10
");'
+ testString: assert(timesFive(2) === 10);
- text: timesFive(0)
应该返回0
- testString: 'assert(timesFive(0) === 0, "timesFive(0)
should return 0
");'
+ testString: assert(timesFive(0) === 0);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.chinese.md
index 5bd589b40d..5435167c3e 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.chinese.md
@@ -18,17 +18,17 @@ localeTitle: 返回函数的早期模式
```yml
tests:
- text: 'abTest(2,2)
应返回一个数字'
- testString: 'assert(typeof abTest(2,2) === "number" , "abTest(2,2)
should return a number");'
+ testString: assert(typeof abTest(2,2) === 'number' );
- text: 'abTest(2,2)
应该返回8
'
- testString: 'assert(abTest(2,2) === 8 , "abTest(2,2)
should return 8
");'
+ testString: assert(abTest(2,2) === 8 );
- text: 'abTest(-2,2)
应返回undefined
'
- testString: 'assert(abTest(-2,2) === undefined , "abTest(-2,2)
should return undefined
");'
+ testString: assert(abTest(-2,2) === undefined );
- text: 'abTest(2,-2)
应返回undefined
'
- testString: 'assert(abTest(2,-2) === undefined , "abTest(2,-2)
should return undefined
");'
+ testString: assert(abTest(2,-2) === undefined );
- text: 'abTest(2,8)
应该返回18
'
- testString: 'assert(abTest(2,8) === 18 , "abTest(2,8)
should return 18
");'
+ testString: assert(abTest(2,8) === 18 );
- text: 'abTest(3,3)
应该返回12
'
- testString: 'assert(abTest(3,3) === 12 , "abTest(3,3)
should return 12
");'
+ testString: assert(abTest(3,3) === 12 );
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.chinese.md
index ff8a9c6fe5..8731753fa6 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 从函数返回布尔值
```yml
tests:
- text: 'isLess(10,15)
应该返回true
'
- testString: 'assert(isLess(10,15) === true, "isLess(10,15)
should return true
");'
+ testString: assert(isLess(10,15) === true);
- text: 'isLess(15,10)
应该返回false
'
- testString: 'assert(isLess(15, 10) === false, "isLess(15,10)
should return false
");'
+ testString: assert(isLess(15, 10) === false);
- text: 您不应该使用任何if
或else
语句
- testString: 'assert(!/if|else/g.test(code), "You should not use any if
or else
statements");'
+ testString: assert(!/if|else/g.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.chinese.md
index c563fd607b..c0ac13a380 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.chinese.md
@@ -7,7 +7,25 @@ localeTitle: 从带有开关语句的多个选项中进行选择
---
## Description
-undefined
+ switch
语句测试一个值,并且可以包含许多定义各种可能值的 case 语句。 从第一个匹配的 case
值开始执行语句,直到遇到 break
。
+这是 switch
语句的示例:
+
+```js
+switch(lowercaseLetter) {
+ case "a":
+ console.log("A");
+ break;
+ case "b":
+ console.log("B");
+ break;
+}
+```
+
+ case
值以严格相等性( ===
)进行测试。 break
告诉JavaScript停止执行语句。 如果省略 break
,将执行下一条语句。
+
+val
并设置以下条件的answer
:
1
- “alpha”
2
- “beta”
3
- “伽玛”
4
- “三角洲” caseInSwitch(1)
的值应为“alpha”
- testString: 'assert(caseInSwitch(1) === "alpha", "caseInSwitch(1)
should have a value of "alpha"");'
+ testString: assert(caseInSwitch(1) === "alpha");
- text: caseInSwitch(2)
的值应为“beta”
- testString: 'assert(caseInSwitch(2) === "beta", "caseInSwitch(2)
should have a value of "beta"");'
+ testString: assert(caseInSwitch(2) === "beta");
- text: caseInSwitch(3)
的值应为“gamma”
- testString: 'assert(caseInSwitch(3) === "gamma", "caseInSwitch(3)
should have a value of "gamma"");'
+ testString: assert(caseInSwitch(3) === "gamma");
- text: caseInSwitch(4)
的值应为“delta”
- testString: 'assert(caseInSwitch(4) === "delta", "caseInSwitch(4)
should have a value of "delta"");'
+ testString: assert(caseInSwitch(4) === "delta");
- text: 您不应该使用任何if
或else
语句
- testString: 'assert(!/else/g.test(code) || !/if/g.test(code), "You should not use any if
or else
statements");'
+ testString: assert(!/else/g.test(code) || !/if/g.test(code));
- text: 你应该至少有3个break
语句
- testString: 'assert(code.match(/break/g).length > 2, "You should have at least 3 break
statements");'
+ testString: assert(code.match(/break/g).length > 2);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.chinese.md
index e88dba12ee..f9394bd562 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.chinese.md
@@ -19,13 +19,13 @@ localeTitle: 购物清单
```yml
tests:
- text: myList
应该是一个数组
- testString: 'assert(isArray, "myList
should be an array");'
+ testString: assert(isArray);
- text: 每个子数组中的第一个元素都必须是字符串
- testString: 'assert(hasString, "The first elements in each of your sub-arrays must all be strings");'
+ testString: assert(hasString);
- text: 每个子数组中的第二个元素都必须是数字
- testString: 'assert(hasNumber, "The second elements in each of your sub-arrays must all be numbers");'
+ testString: assert(hasNumber);
- text: 您的列表中必须至少有5个项目
- testString: 'assert(count > 4, "You must have at least 5 items in your list");'
+ testString: assert(count > 4);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.chinese.md
index 88287c0680..d39f504872 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.chinese.md
@@ -19,15 +19,15 @@ localeTitle: 站在队中
```yml
tests:
- text: 'nextInLine([], 5)
应返回一个数字。'
- testString: 'assert.isNumber(nextInLine([],5), "nextInLine([], 5)
should return a number.");'
+ testString: assert.isNumber(nextInLine([],5));
- text: 'nextInLine([], 1)
应该返回1
'
- testString: 'assert(nextInLine([],1) === 1, "nextInLine([], 1)
should return 1
");'
+ testString: assert(nextInLine([],1) === 1);
- text: 'nextInLine([2], 1)
应返回2
'
- testString: 'assert(nextInLine([2],1) === 2, "nextInLine([2], 1)
should return 2
");'
+ testString: assert(nextInLine([2],1) === 2);
- text: 'nextInLine([5,6,7,8,9], 1)
应该返回5
'
- testString: 'assert(nextInLine([5,6,7,8,9],1) === 5, "nextInLine([5,6,7,8,9], 1)
should return 5
");'
+ testString: assert(nextInLine([5,6,7,8,9],1) === 5);
- text: '在nextInLine(testArr, 10)
, testArr[4]
应为10
'
- testString: 'nextInLine(testArr, 10); assert(testArr[4] === 10, "After nextInLine(testArr, 10)
, testArr[4]
should be 10
");'
+ testString: nextInLine(testArr, 10); assert(testArr[4] === 10);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.chinese.md
index ad844e2428..8b705e4b3c 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 使用JavaScript数组在一个变量中存储多个值
```yml
tests:
- text: myArray
应该是一个array
。
- testString: 'assert(typeof myArray == "object", "myArray
should be an array
.");'
+ testString: assert(typeof myArray == 'object');
- text: myArray
的第一项应该是一个string
。
- testString: 'assert(typeof myArray[0] !== "undefined" && typeof myArray[0] == "string", "The first item in myArray
should be a string
.");'
+ testString: assert(typeof myArray[0] !== 'undefined' && typeof myArray[0] == 'string');
- text: myArray
的第二项应该是一个number
。
- testString: 'assert(typeof myArray[1] !== "undefined" && typeof myArray[1] == "number", "The second item in myArray
should be a number
.");'
+ testString: assert(typeof myArray[1] !== 'undefined' && typeof myArray[1] == 'number');
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.chinese.md
index 95d149de5d..4030dcb68a 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 使用赋值运算符存储值
```yml
tests:
- text: 不要更改行上方的代码
- testString: 'assert(/var a;/.test(code) && /var b = 2;/.test(code), "Do not change code above the line");'
+ testString: assert(/var a;/.test(code) && /var b = 2;/.test(code));
- text: a
的值应为7
- testString: 'assert(typeof a === "number" && a === 7, "a
should have a value of 7");'
+ testString: assert(typeof a === 'number' && a === 7);
- text: b
的值应为7
- testString: 'assert(typeof b === "number" && b === 7, "b
should have a value of 7");'
+ testString: assert(typeof b === 'number' && b === 7);
- text: a
应分配给b
=
- testString: 'assert(/b\s*=\s*a\s*;/g.test(code), "a
should be assigned to b
with =
");'
+ testString: assert(/b\s*=\s*a\s*;/g.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.chinese.md
index 3f9280ed1e..dc707b5ca9 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.chinese.md
@@ -17,10 +17,10 @@ localeTitle: 使用JavaScript从另一个数字中减去一个数字
```yml
tests:
- - text: ''
- testString: 'assert(difference === 12, "Make the variable difference
equal 12.");'
+ - text: 使变量difference
等于12。
+ testString: assert(difference === 12);
- text: 只从45中减去一个数字。
- testString: 'assert(/var\s*difference\s*=\s*45\s*-\s*[0-9]*;(?!\s*[a-zA-Z0-9]+)/.test(code),"Only subtract one number from 45.");'
+ testString: assert(/difference=45-33;?/.test(code.replace(/\s/g, '')));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.chinese.md
index b6ea378351..6157c05269 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 测试属性的对象
```yml
tests:
- text: checkObj("gift")
应该返回"pony"
。
- testString: 'assert(checkObj("gift") === "pony", "checkObj("gift")
should return "pony"
.");'
+ testString: assert(checkObj("gift") === "pony");
- text: checkObj("pet")
应该返回"kitten"
。
- testString: 'assert(checkObj("pet") === "kitten", "checkObj("pet")
should return "kitten"
.");'
+ testString: assert(checkObj("pet") === "kitten");
- text: checkObj("house")
应该返回"Not Found"
。
- testString: 'assert(checkObj("house") === "Not Found", "checkObj("house")
should return "Not Found"
.");'
+ testString: assert(checkObj("house") === "Not Found");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.chinese.md
index fdd18fac86..c9e4195179 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 理解字符串不变性
```yml
tests:
- text: myStr
应该具有Hello World
的值
- testString: 'assert(myStr === "Hello World", "myStr
should have a value of Hello World
");'
+ testString: assert(myStr === "Hello World");
- text: 不要更改行上方的代码
- testString: 'assert(/myStr = "Jello World"/.test(code), "Do not change the code above the line");'
+ testString: assert(/myStr = "Jello World"/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-boolean-values.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-boolean-values.chinese.md
index 74ea06f695..c6af1edf38 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-boolean-values.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-boolean-values.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 了解布尔值
```yml
tests:
- text: welcomeToBooleans()
函数应该返回一个布尔值(true / false)。
- testString: 'assert(typeof welcomeToBooleans() === "boolean", "The welcomeToBooleans()
function should return a boolean (true/false) value.");'
+ testString: assert(typeof welcomeToBooleans() === 'boolean');
- text: welcomeToBooleans()
应该返回true。
- testString: 'assert(welcomeToBooleans() === true, "welcomeToBooleans()
should return true.");'
+ testString: assert(welcomeToBooleans() === true);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.chinese.md
index 58e968ede7..7cbdc6a3a2 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.chinese.md
@@ -18,17 +18,17 @@ localeTitle: 了解变量中的大小写敏感度
```yml
tests:
- text: studlyCapVar
已定义且值为10
- testString: 'assert(typeof studlyCapVar !== "undefined" && studlyCapVar === 10, "studlyCapVar
is defined and has a value of 10
");'
+ testString: assert(typeof studlyCapVar !== 'undefined' && studlyCapVar === 10);
- text: properCamelCase
已定义且值为"A String"
- testString: 'assert(typeof properCamelCase !== "undefined" && properCamelCase === "A String", "properCamelCase
is defined and has a value of "A String"
");'
+ testString: assert(typeof properCamelCase !== 'undefined' && properCamelCase === "A String");
- text: titleCaseOver
已定义,其值为9000
- testString: 'assert(typeof titleCaseOver !== "undefined" && titleCaseOver === 9000, "titleCaseOver
is defined and has a value of 9000
");'
+ testString: assert(typeof titleCaseOver !== 'undefined' && titleCaseOver === 9000);
- text: studlyCapVar
应该在声明和赋值部分使用camelCase。
- testString: 'assert(code.match(/studlyCapVar/g).length === 2, "studlyCapVar
should use camelCase in both declaration and assignment sections.");'
+ testString: assert(code.match(/studlyCapVar/g).length === 2);
- text: properCamelCase
应该在声明和赋值部分使用camelCase。
- testString: 'assert(code.match(/properCamelCase/g).length === 2, "properCamelCase
should use camelCase in both declaration and assignment sections.");'
+ testString: assert(code.match(/properCamelCase/g).length === 2);
- text: titleCaseOver
应该在声明和赋值部分使用camelCase。
- testString: 'assert(code.match(/titleCaseOver/g).length === 2, "titleCaseOver
should use camelCase in both declaration and assignment sections.");'
+ testString: assert(code.match(/titleCaseOver/g).length === 2);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.chinese.md
index f18b535d8c..4867682866 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 了解从函数返回的未定义值
```yml
tests:
- text: addFive
应该是一个函数
- testString: 'assert(typeof addFive === "function", "addFive
should be a function");'
+ testString: assert(typeof addFive === 'function');
- text: sum
应该等于8
- testString: 'assert(sum === 8, "sum
should be equal to 8");'
+ testString: assert(sum === 8);
- text: addFive
返回值应该是undefined
- testString: 'assert(addFive() === undefined, "Returned value from addFive
should be undefined
");'
+ testString: assert(addFive() === undefined);
- text: 在函数内部,向sum
变量添加5
- testString: 'assert(code.match(/(sum\s*\=\s*sum\s*\+\s*5)|(sum\s*\+\=\s*5)/g).length === 1, "Inside of your functions, add 5 to the sum
variable");'
+ testString: assert(addFive.toString().replace(/\s/g, '').match(/sum=sum\+5|sum\+=5/));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.chinese.md
index 2dae43590c..2cb76233af 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 了解未初始化的变量
```yml
tests:
- text: a
应定义并评估其值为6
- testString: 'assert(typeof a === "number" && a === 6, "a
should be defined and evaluated to have the value of 6
");'
+ testString: assert(typeof a === 'number' && a === 6);
- text: 应定义和评估b
的值为15
- testString: 'assert(typeof b === "number" && b === 15, "b
should be defined and evaluated to have the value of 15
");'
+ testString: assert(typeof b === 'number' && b === 15);
- text: c
不应该包含undefined
并且值应为“我是一个字符串!”
- testString: 'assert(!/undefined/.test(c) && c === "I am a String!", "c
should not contain undefined
and should have a value of "I am a String!"");'
+ testString: assert(!/undefined/.test(c) && c === "I am a String!");
- text: 不要更改行下方的代码
- testString: 'assert(/a = a \+ 1;/.test(code) && /b = b \+ 5;/.test(code) && /c = c \+ " String!";/.test(code), "Do not change code below the line");'
+ testString: assert(/a = a \+ 1;/.test(code) && /b = b \+ 5;/.test(code) && /c = c \+ " String!";/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.chinese.md
index 929d5f0f34..ee2731c9dd 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 更新对象属性
```yml
tests:
- text: 将myDog
的"name"
属性更新为“Happy Coder”。
- testString: 'assert(/happy coder/gi.test(myDog.name), "Update myDog
's "name"
property to equal "Happy Coder".");'
+ testString: assert(/happy coder/gi.test(myDog.name));
- text: 不要编辑myDog
定义
- testString: 'assert(/"name": "Coder"/.test(code), "Do not edit the myDog
definition");'
+ testString: 'assert(/"name": "Coder"/.test(code));'
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.chinese.md
index 5883883862..c2dd890371 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用括号表示法查找字符串中的第一个字符
```yml
tests:
- text: firstLetterOfLastName
变量的值应为L
- testString: 'assert(firstLetterOfLastName === "L", "The firstLetterOfLastName
variable should have the value of L
.");'
+ testString: assert(firstLetterOfLastName === 'L');
- text: 您应该使用括号表示法。
- testString: 'assert(code.match(/firstLetterOfLastName\s*?=\s*?lastName\[.*?\]/), "You should use bracket notation.");'
+ testString: assert(code.match(/firstLetterOfLastName\s*?=\s*?lastName\[.*?\]/));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.chinese.md
index 3947cd2463..a1e5b81e3c 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用括号表示法查找字符串中的最后一个字符
```yml
tests:
- text: lastLetterOfLastName
应为“e”。
- testString: 'assert(lastLetterOfLastName === "e", "lastLetterOfLastName
should be "e".");'
+ testString: assert(lastLetterOfLastName === "e");
- text: 你必须使用.length
来获取最后一个字母。
- testString: 'assert(code.match(/\.length/g).length === 2, "You have to use .length
to get the last letter.");'
+ testString: assert(code.match(/\.length/g).length === 2);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.chinese.md
index 8c62281c85..0b3e1f0f4f 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用括号表示法查找字符串中的第N个字符
```yml
tests:
- text: thirdLetterOfLastName
变量的值应为v
。
- testString: 'assert(thirdLetterOfLastName === "v", "The thirdLetterOfLastName
variable should have the value of v
.");'
+ testString: assert(thirdLetterOfLastName === 'v');
- text: 您应该使用括号表示法。
- testString: 'assert(code.match(/thirdLetterOfLastName\s*?=\s*?lastName\[.*?\]/), "You should use bracket notation.");'
+ testString: assert(code.match(/thirdLetterOfLastName\s*?=\s*?lastName\[.*?\]/));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.chinese.md
index 930d97a54a..07b431031f 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用括号表示法查找字符串中的第N个到最后一个字
```yml
tests:
- text: secondToLastLetterOfLastName
应为“c”。
- testString: 'assert(secondToLastLetterOfLastName === "c", "secondToLastLetterOfLastName
should be "c".");'
+ testString: assert(secondToLastLetterOfLastName === 'c');
- text: 你必须使用.length
来获得倒数第二个字母。
- testString: 'assert(code.match(/\.length/g).length === 2, "You have to use .length
to get the second last letter.");'
+ testString: assert(code.match(/\.length/g).length === 2);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-conditional-logic-with-if-statements.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-conditional-logic-with-if-statements.chinese.md
index b2257d60e8..fff6621b10 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-conditional-logic-with-if-statements.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-conditional-logic-with-if-statements.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 使用条件逻辑和If语句
```yml
tests:
- text: trueOrFalse
应该是一个函数
- testString: 'assert(typeof trueOrFalse === "function", "trueOrFalse
should be a function");'
+ testString: assert(typeof trueOrFalse === "function");
- text: trueOrFalse(true)
应该返回一个字符串
- testString: 'assert(typeof trueOrFalse(true) === "string", "trueOrFalse(true)
should return a string");'
+ testString: assert(typeof trueOrFalse(true) === "string");
- text: trueOrFalse(false)
应该返回一个字符串
- testString: 'assert(typeof trueOrFalse(false) === "string", "trueOrFalse(false)
should return a string");'
+ testString: assert(typeof trueOrFalse(false) === "string");
- text: trueOrFalse(true)
应该返回“是的,那是真的”
- testString: 'assert(trueOrFalse(true) === "Yes, that was true", "trueOrFalse(true)
should return "Yes, that was true"");'
+ testString: assert(trueOrFalse(true) === "Yes, that was true");
- text: trueOrFalse(false)
应该返回“No,that was false”
- testString: 'assert(trueOrFalse(false) === "No, that was false", "trueOrFalse(false)
should return "No, that was false"");'
+ testString: assert(trueOrFalse(false) === "No, that was false");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.chinese.md
index f916539b28..b7e7f11f3f 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 使用多个条件(三元)运算符
```yml
tests:
- text: checkSign
应该使用多个conditional operators
- testString: 'assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code), "checkSign
should use multiple conditional operators
");'
+ testString: assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code));
- text: checkSign(10)
应该返回“positive”。请注意,资本化很重要
- testString: 'assert(checkSign(10) === "positive", "checkSign(10)
should return "positive". Note that capitalization matters");'
+ testString: assert(checkSign(10) === 'positive');
- text: checkSign(-12)
应返回“否定”。请注意,资本化很重要
- testString: 'assert(checkSign(-12) === "negative", "checkSign(-12)
should return "negative". Note that capitalization matters");'
+ testString: assert(checkSign(-12) === 'negative');
- text: checkSign(0)
应返回“零”。请注意,资本化很重要
- testString: 'assert(checkSign(0) === "zero", "checkSign(0)
should return "zero". Note that capitalization matters");'
+ testString: assert(checkSign(0) === 'zero');
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.chinese.md
index 328f565a0f..f86058f3a9 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 使用条件(三元)运算符
```yml
tests:
- text: checkEqual
应该使用conditional operator
- testString: 'assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code), "checkEqual
should use the conditional operator
");'
+ testString: assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(code));
- text: 'checkEqual(1, 2)
应该返回false'
- testString: 'assert(checkEqual(1, 2) === false, "checkEqual(1, 2)
should return false");'
+ testString: assert(checkEqual(1, 2) === "Not Equal");
- text: 'checkEqual(1, 1)
应该返回true'
- testString: 'assert(checkEqual(1, 1) === true, "checkEqual(1, 1)
should return true");'
+ testString: assert(checkEqual(1, 1) === "Equal");
- text: 'checkEqual(1, -1)
应该返回false'
- testString: 'assert(checkEqual(1, -1) === false, "checkEqual(1, -1)
should return false");'
+ testString: assert(checkEqual(1, -1) === "Not Equal");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.chinese.md
index a72f6f58f1..0c7a073f57 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 将parseInt函数与Radix一起使用
```yml
tests:
- text: convertToInteger
应该使用parseInt()
函数
- testString: 'assert(/parseInt/g.test(code), "convertToInteger
should use the parseInt()
function");'
+ testString: assert(/parseInt/g.test(code));
- text: convertToInteger("10011")
应该返回一个数字
- testString: 'assert(typeof(convertToInteger("10011")) === "number", "convertToInteger("10011")
should return a number");'
+ testString: assert(typeof(convertToInteger("10011")) === "number");
- text: convertToInteger("10011")
应该返回19
- testString: 'assert(convertToInteger("10011") === 19, "convertToInteger("10011")
should return 19");'
+ testString: assert(convertToInteger("10011") === 19);
- text: convertToInteger("111001")
应该返回57
- testString: 'assert(convertToInteger("111001") === 57, "convertToInteger("111001")
should return 57");'
+ testString: assert(convertToInteger("111001") === 57);
- text: convertToInteger("JamesBond")
应该返回NaN
- testString: 'assert.isNaN(convertToInteger("JamesBond"), "convertToInteger("JamesBond")
should return NaN");'
+ testString: assert.isNaN(convertToInteger("JamesBond"));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.chinese.md
index dd0baf4446..9e4db19400 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 使用parseInt函数
```yml
tests:
- text: convertToInteger
应该使用parseInt()
函数
- testString: 'assert(/parseInt/g.test(code), "convertToInteger
should use the parseInt()
function");'
+ testString: assert(/parseInt/g.test(code));
- text: convertToInteger("56")
应该返回一个数字
- testString: 'assert(typeof(convertToInteger("56")) === "number", "convertToInteger("56")
should return a number");'
+ testString: assert(typeof(convertToInteger("56")) === "number");
- text: convertToInteger("56")
应该返回56
- testString: 'assert(convertToInteger("56") === 56, "convertToInteger("56")
should return 56");'
+ testString: assert(convertToInteger("56") === 56);
- text: convertToInteger("77")
应该返回77
- testString: 'assert(convertToInteger("77") === 77, "convertToInteger("77")
should return 77");'
+ testString: assert(convertToInteger("77") === 77);
- text: convertToInteger("JamesBond")
应该返回NaN
- testString: 'assert.isNaN(convertToInteger("JamesBond"), "convertToInteger("JamesBond")
should return NaN");'
+ testString: assert.isNaN(convertToInteger("JamesBond"));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.chinese.md
index f0d75d8ef7..dcb90d8de9 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.chinese.md
@@ -18,23 +18,23 @@ localeTitle: 使用对象进行查找
```yml
tests:
- text: phoneticLookup("alpha")
应该等于"Adams"
- testString: 'assert(phoneticLookup("alpha") === "Adams", "phoneticLookup("alpha")
should equal "Adams"
");'
+ testString: assert(phoneticLookup("alpha") === 'Adams');
- text: phoneticLookup("bravo")
应该等于"Boston"
- testString: 'assert(phoneticLookup("bravo") === "Boston", "phoneticLookup("bravo")
should equal "Boston"
");'
+ testString: assert(phoneticLookup("bravo") === 'Boston');
- text: phoneticLookup("charlie")
应该等于"Chicago"
- testString: 'assert(phoneticLookup("charlie") === "Chicago", "phoneticLookup("charlie")
should equal "Chicago"
");'
+ testString: assert(phoneticLookup("charlie") === 'Chicago');
- text: phoneticLookup("delta")
应该等于"Denver"
- testString: 'assert(phoneticLookup("delta") === "Denver", "phoneticLookup("delta")
should equal "Denver"
");'
+ testString: assert(phoneticLookup("delta") === 'Denver');
- text: phoneticLookup("echo")
应该等于"Easy"
- testString: 'assert(phoneticLookup("echo") === "Easy", "phoneticLookup("echo")
should equal "Easy"
");'
+ testString: assert(phoneticLookup("echo") === 'Easy');
- text: phoneticLookup("foxtrot")
应该等于"Frank"
- testString: 'assert(phoneticLookup("foxtrot") === "Frank", "phoneticLookup("foxtrot")
should equal "Frank"
");'
+ testString: assert(phoneticLookup("foxtrot") === 'Frank');
- text: phoneticLookup("")
应该等于undefined
- testString: 'assert(typeof phoneticLookup("") === "undefined", "phoneticLookup("")
should equal undefined
");'
+ testString: assert(typeof phoneticLookup("") === 'undefined');
- text: 您不应该修改return
语句
- testString: 'assert(code.match(/return\sresult;/), "You should not modify the return
statement");'
+ testString: assert(code.match(/return\sresult;/));
- text: 您不应该使用case
, switch
或if
语句
- testString: 'assert(!/case|switch|if/g.test(code.replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g,"")), "You should not use case
, switch
, or if
statements"); '
+ testString: assert(!/case|switch|if/g.test(code.replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g,'')));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.chinese.md
index 48fc484cb1..e879a74385 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 字空白
```yml
tests:
- text: 'wordBlanks("","","","")
应该返回一个字符串。'
- testString: 'assert(typeof wordBlanks("","","","") === "string", "wordBlanks("","","","")
should return a string.");'
+ testString: assert(typeof wordBlanks("","","","") === "string");
- text: 'wordBlanks("dog", "big", "ran", "quickly")
应包含由非单词字符(以及madlib中的任何其他单词)分隔的所有传入单词。'
- testString: 'assert(/\bdog\b/.test(test1) && /\bbig\b/.test(test1) && /\bran\b/.test(test1) && /\bquickly\b/.test(test1),"wordBlanks("dog", "big", "ran", "quickly")
should contain all of the passed in words separated by non-word characters (and any additional words in your madlib).");'
+ testString: assert(/\bdog\b/.test(test1) && /\bbig\b/.test(test1) && /\bran\b/.test(test1) && /\bquickly\b/.test(test1));
- text: 'wordBlanks("cat", "little", "hit", "slowly")
应包含由非单词字符(以及madlib中的任何其他单词)分隔的所有传入单词。'
- testString: 'assert(/\bcat\b/.test(test2) && /\blittle\b/.test(test2) && /\bhit\b/.test(test2) && /\bslowly\b/.test(test2),"wordBlanks("cat", "little", "hit", "slowly")
should contain all of the passed in words separated by non-word characters (and any additional words in your madlib).");'
+ testString: assert(/\bcat\b/.test(test2) && /\blittle\b/.test(test2) && /\bhit\b/.test(test2) && /\bslowly\b/.test(test2));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.chinese.md
index 71911873f6..4d77614a56 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 用函数编写可重用的JavaScript
```yml
tests:
- text: reusableFunction
应该是一个函数
- testString: 'assert(typeof reusableFunction === "function", "reusableFunction
should be a function");'
+ testString: assert(typeof reusableFunction === 'function');
- text: reusableFunction
应该将“Hi World”输出到开发控制台
- testString: 'assert("Hi World" === logOutput, "reusableFunction
should output "Hi World" to the dev console");'
+ testString: assert(hiWorldWasLogged);
- text: 定义后调用reusableFunction
- testString: 'assert(/^\s*reusableFunction\(\)\s*;/m.test(code), "Call reusableFunction
after you define it");'
+ testString: assert(/^\s*reusableFunction\(\)\s*/m.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.chinese.md
index 1eae220e44..a82e59e998 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 调用函数时捕获以错误顺序传递的参数
```yml
tests:
- text: 你的代码应该固定可变power
因此它等于2提升到3功率,而不是3增加到2功率。
- testString: 'assert(power == 8, "Your code should fix the variable power
so it equals 2 raised to the 3rd power, not 3 raised to the 2nd power.");'
+ testString: assert(power == 8);
- text: 您的代码应使用raiseToPower
函数调用的正确参数顺序。
- testString: 'assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g), "Your code should use the correct order of the arguments for the raiseToPower
function call.");'
+ testString: assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.chinese.md
index 062ceb7176..b1c2075406 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 在函数调用后捕获缺失的打开和关闭括号
```yml
tests:
- text: 您的代码应修复变量result
以便将其设置为函数getNine
返回的数字。
- testString: 'assert(result == 9, "Your code should fix the variable result
so it is set to the number that the function getNine
returns.");'
+ testString: assert(result == 9);
- text: 您的代码应该调用getNine
函数。
- testString: 'assert(code.match(/getNine\(\)/g).length == 2, "Your code should call the getNine
function.");'
+ testString: assert(code.match(/getNine\(\)/g).length == 2);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.chinese.md
index 2cc7a4fec4..dd1b828a27 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 捕获拼错的变量和函数名称
```yml
tests:
- text: 检查netWorkingCapital计算中使用的两个变量的拼写,控制台输出应显示“净营运资金为:2”。
- testString: 'assert(netWorkingCapital === 2, "Check the spelling of the two variables used in the netWorkingCapital calculation, the console output should show that "Net working capital is: 2".");'
+ testString: 'assert(netWorkingCapital === 2);'
- text: 代码中不应存在拼写错误的变量。
- testString: 'assert(!code.match(/recievables/g), "There should be no instances of mis-spelled variables in the code.");'
+ testString: assert(!code.match(/recievables/g));
- text: receivables
在代码中声明并正确使用应receivables
变量。
- testString: 'assert(code.match(/receivables/g).length == 2, "The receivables
variable should be declared and used properly in the code.");'
+ testString: assert(code.match(/receivables/g).length == 2);
- text: 代码中不应存在拼写错误的变量。
- testString: 'assert(!code.match(/payable;/g), "There should be no instances of mis-spelled variables in the code.");'
+ testString: assert(!code.match(/payable;/g));
- text: 应在组织中声明并正确使用payables
变量。
- testString: 'assert(code.match(/payables/g).length == 2, "The payables
variable should be declared and used properly in the code.");'
+ testString: assert(code.match(/payables/g).length == 2);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.chinese.md
index 02b6c23e68..4a4e0c0f8d 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 抓住单引号和双引号的混合使用
```yml
tests:
- text: '您的代码应该通过更改或转义它们来修复href
值“#Home”周围的引号。'
- testString: 'assert(code.match(//g), "Your code should fix the quotes around the href
value "#Home" by either changing or escaping them.");'
+ testString: assert(code.match(//g));
- text: 您的代码应该在整个字符串周围保留双引号。
- testString: 'assert(code.match(/".reduce()
方法的缺失部分。控制台输出应显示“数组值的总和为:6”。
- testString: 'assert(arraySum === 6, "Your code should fix the missing piece of the .reduce()
method. The console output should show that "Sum of array values is: 6".");'
+ testString: 'assert(arraySum === 6);'
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.chinese.md
index 1a659e04b3..8989bc05c9 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 捕获使用赋值运算符而不是等式运算符
```yml
tests:
- text: 您的代码应该修复条件,以便检查是否相等,而不是使用赋值。
- testString: 'assert(result == "Not equal!", "Your code should fix the condition so it checks for equality, instead of using assignment.");'
+ testString: assert(result == "Not equal!");
- text: 条件可以使用==
或===
来测试相等性。
- testString: 'assert(code.match(/x\s*?===?\s*?y/g), "The condition can use either ==
or ===
to test for equality.");'
+ testString: assert(code.match(/x\s*?===?\s*?y/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.chinese.md
index 8bd43a7c0d..86023f445d 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用有效的终端条件防止无限循环
```yml
tests:
- text: 您的代码应该更改for
循环的终端条件(中间部分)中的比较运算符。
- testString: 'assert(code.match(/i\s*?<=\s*?4;/g).length == 1, "Your code should change the comparison operator in the terminal condition (the middle part) of the for
loop.");'
+ testString: assert(code.match(/i\s*?<=\s*?4;/g).length == 1);
- text: 您的代码应该在循环的终端条件中修复比较运算符。
- testString: 'assert(!code.match(/i\s*?!=\s*?4;/g), "Your code should fix the comparison operator in the terminal condition of the loop.");'
+ testString: assert(!code.match(/i\s*?!=\s*?4;/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/use-caution-when-reinitializing-variables-inside-a-loop.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/use-caution-when-reinitializing-variables-inside-a-loop.chinese.md
index 88c11f61c4..3a05a7a3f0 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/use-caution-when-reinitializing-variables-inside-a-loop.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/use-caution-when-reinitializing-variables-inside-a-loop.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 在循环内重新初始化变量时请小心
```yml
tests:
- text: 您的代码应该将matrix
变量设置为一个数组,每个数组包含3行,每列2列零。
- testString: 'assert(JSON.stringify(matrix) == "[[0,0],[0,0],[0,0]]", "Your code should set the matrix
variable to an array holding 3 rows of 2 columns of zeroes each.");'
+ testString: assert(JSON.stringify(matrix) == "[[0,0],[0,0],[0,0]]");
- text: matrix
变量应该有3行。
- testString: 'assert(matrix.length == 3, "The matrix
variable should have 3 rows.");'
+ testString: assert(matrix.length == 3);
- text: matrix
变量每行应有2列。
- testString: 'assert(matrix[0].length == 2 && matrix[1].length === 2 && matrix[2].length === 2, "The matrix
variable should have 2 columns in each row.");'
+ testString: assert(matrix[0].length == 2 && matrix[1].length === 2 && matrix[2].length === 2);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.chinese.md
index c73d7b94e2..d428f95dcc 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.chinese.md
@@ -18,7 +18,7 @@ localeTitle: 使用JavaScript控制台检查变量的值
```yml
tests:
- text: 您的代码应使用console.log()
来检查变量a
的值。
- testString: 'assert(code.match(/console\.log\(a\)/g), "Your code should use console.log()
to check the value of the variable a
.");'
+ testString: assert(code.match(/console\.log\(a\)/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.chinese.md
index ffdd9562f5..625250fcd9 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 使用typeof检查变量的类型
```yml
tests:
- text: 您的代码应在两个console.log()
语句中使用typeof
来检查变量的类型。
- testString: 'assert(code.match(/console\.log\(typeof[\( ].*\)?\)/g).length == 2, "Your code should use typeof
in two console.log()
statements to check the type of the variables.");'
+ testString: assert(code.match(/console\.log\(typeof[\( ].*\)?\)/g).length == 2);
- text: 您的代码应使用typeof
来检查变量类型seven
。
- testString: 'assert(code.match(/typeof[\( ]seven\)?/g), "Your code should use typeof
to check the type of the variable seven
.");'
+ testString: assert(code.match(/typeof[\( ]seven\)?/g));
- text: 您的代码应使用typeof
来检查变量的类型three
。
- testString: 'assert(code.match(/typeof[\( ]three\)?/g), "Your code should use typeof
to check the type of the variable three
.");'
+ testString: assert(code.match(/typeof[\( ]three\)?/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.chinese.md
index bec5bca834..bbd899b305 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 比较var的范围并让关键字
```yml
tests:
- text: var
在代码中不存在。
- testString: 'getUserInput => assert(!getUserInput("index").match(/var/g),"var
does not exist in code.");'
+ testString: getUserInput => assert(!getUserInput('index').match(/var/g));
- text: 在if语句中声明的变量i
应该等于“块范围”。
- testString: 'getUserInput => assert(getUserInput("index").match(/(i\s*=\s*).*\s*.*\s*.*\1("|")block\s*scope\2/g), "The variable i
declared in the if statement should equal "block scope".");'
+ testString: getUserInput => assert(getUserInput('index').match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g));
- text: checkScope()
应该返回“函数范围”
- testString: 'assert(checkScope() === "function scope", "checkScope()
should return "function scope"");'
+ testString: assert(checkScope() === "function scope");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.chinese.md
index bf38f6777a..6ec695c0d4 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.chinese.md
@@ -18,7 +18,7 @@ localeTitle: 使用导出默认值创建导出回退
```yml
tests:
- text: 适当使用export
回落。
- testString: 'getUserInput => assert(getUserInput("index").match(/export\s+default\s+function\s+subtract\(x,y\)\s+{return\s+x\s-\s+y;}/g), "Proper used of export
fallback.");'
+ testString: assert(code.match(/export\s+default\s+function(\s+subtract\s*|\s*)\(\s*x,\s*y\s*\)\s*{/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/declare-a-read-only-variable-with-the-const-keyword.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/declare-a-read-only-variable-with-the-const-keyword.chinese.md
index fa7c1f6755..44371498af 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/declare-a-read-only-variable-with-the-const-keyword.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/declare-a-read-only-variable-with-the-const-keyword.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 使用const关键字声明只读变量
```yml
tests:
- text: var
在您的代码中不存在。
- testString: 'getUserInput => assert(!getUserInput("index").match(/var/g),"var
does not exist in your code.");'
+ testString: getUserInput => assert(!getUserInput('index').match(/var/g));
- text: SENTENCE
应该是用const
声明的常量变量。
- testString: 'getUserInput => assert(getUserInput("index").match(/(const SENTENCE)/g), "SENTENCE
should be a constant variable declared with const
.");'
+ testString: getUserInput => assert(getUserInput('index').match(/(const SENTENCE)/g));
- text: i
应该以let
来宣布。
- testString: 'getUserInput => assert(getUserInput("index").match(/(let i)/g), "i
should be declared with let
.");'
+ testString: getUserInput => assert(getUserInput('index').match(/(let i)/g));
- text: 应更改console.log
以打印SENTENCE
变量。
- testString: 'getUserInput => assert(getUserInput("index").match(/console\.log\(\s*SENTENCE\s*\)\s*;?/g), "console.log
should be adjusted to print the variable SENTENCE
.");'
+ testString: getUserInput => assert(getUserInput('index').match(/console\.log\(\s*SENTENCE\s*\)\s*;?/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/explore-differences-between-the-var-and-let-keywords.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/explore-differences-between-the-var-and-let-keywords.chinese.md
index f633a7a5cf..164eb4873c 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/explore-differences-between-the-var-and-let-keywords.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/explore-differences-between-the-var-and-let-keywords.chinese.md
@@ -23,11 +23,11 @@ localeTitle: 探索var和let关键字之间的差异
```yml
tests:
- text: var
在代码中不存在。
- testString: 'getUserInput => assert(!getUserInput("index").match(/var/g),"var
does not exist in code.");'
+ testString: getUserInput => assert(!getUserInput('index').match(/var/g));
- text: catName
应该是Oliver
。
- testString: 'assert(catName === "Oliver", "catName
should be Oliver
.");'
+ testString: assert(catName === "Oliver");
- text: quote
应该是"Oliver says Meow!"
- testString: 'assert(quote === "Oliver says Meow!", "quote
should be "Oliver says Meow!"
");'
+ testString: assert(quote === "Oliver says Meow!");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.chinese.md
index 0b48fbe988..9c7e782e6c 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.chinese.md
@@ -18,7 +18,7 @@ localeTitle: 导入默认导出
```yml
tests:
- text: 正确导入export default
方法。
- testString: 'getUserInput => assert(getUserInput("index").match(/import\s+subtract\s+from\s+"math_functions"/g), "Properly imports export default
method.");'
+ testString: assert(code.match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.chinese.md
index 3913b30784..6fa3aaf595 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 改变用const声明的数组
```yml
tests:
- text: 不要替换const
关键字。
- testString: 'getUserInput => assert(getUserInput("index").match(/const/g), "Do not replace const
keyword.");'
+ testString: getUserInput => assert(getUserInput('index').match(/const/g));
- text: s
应该是一个常量变量(使用const
)。
- testString: 'getUserInput => assert(getUserInput("index").match(/const\s+s/g), "s
should be a constant variable (by using const
).");'
+ testString: getUserInput => assert(getUserInput('index').match(/const\s+s/g));
- text: 不要更改原始数组声明。
- testString: 'getUserInput => assert(getUserInput("index").match(/const\s+s\s*=\s*\[\s*5\s*,\s*7\s*,\s*2\s*\]\s*;?/g), "Do not change the original array declaration.");'
+ testString: getUserInput => assert(getUserInput('index').match(/const\s+s\s*=\s*\[\s*5\s*,\s*7\s*,\s*2\s*\]\s*;?/g));
- text: 's
应该等于[2, 5, 7]
。'
- testString: 'assert.deepEqual(s, [2, 5, 7], "s
should be equal to [2, 5, 7]
.");'
+ testString: assert.deepEqual(s, [2, 5, 7]);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.chinese.md
index dfe5614c1f..2c742b271f 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 防止对象突变
```yml
tests:
- text: 不要替换const
关键字。
- testString: 'getUserInput => assert(getUserInput("index").match(/const/g), "Do not replace const
keyword.");'
+ testString: getUserInput => assert(getUserInput('index').match(/const/g));
- text: MATH_CONSTANTS
应该是一个常量变量(使用const
)。
- testString: 'getUserInput => assert(getUserInput("index").match(/const\s+MATH_CONSTANTS/g), "MATH_CONSTANTS
should be a constant variable (by using const
).");'
+ testString: getUserInput => assert(getUserInput('index').match(/const\s+MATH_CONSTANTS/g));
- text: 请勿更改原始MATH_CONSTANTS
。
- testString: 'getUserInput => assert(getUserInput("index").match(/const\s+MATH_CONSTANTS\s+=\s+{\s+PI:\s+3.14\s+};/g), "Do not change original MATH_CONSTANTS
.");'
+ testString: getUserInput => assert(getUserInput('index').match(/const\s+MATH_CONSTANTS\s+=\s+{\s+PI:\s+3.14\s+};/g));
- text: PI
等于3.14
。
- testString: 'assert(PI === 3.14, "PI
equals 3.14
.");'
+ testString: assert(PI === 3.14);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.chinese.md
index 2ffe73c2be..8907d569c1 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 设置函数的默认参数
```yml
tests:
- text: 'increment(5, 2)
应为7
。'
- testString: 'assert(increment(5, 2) === 7, "The result of increment(5, 2)
should be 7
.");'
+ testString: assert(increment(5, 2) === 7);
- text: increment(5)
的结果应为6
。
- testString: 'assert(increment(5) === 6, "The result of increment(5)
should be 6
.");'
+ testString: assert(increment(5) === 6);
- text: 默认参数1
用于value
。
- testString: 'getUserInput => assert(getUserInput("index").match(/value\s*=\s*1/g), "default parameter 1
was used for value
.");'
+ testString: assert(code.match(/value\s*=\s*1/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.chinese.md
index 05ae9b6034..5558d346bc 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.chinese.md
@@ -18,7 +18,7 @@ localeTitle: 使用*从文件导入所有内容
```yml
tests:
- text: 正确使用import * as
语法。
- testString: 'assert(code.match(/import\s+\*\s+as\s+[a-zA-Z0-9_$]+\s+from\s*"\s*capitalize_strings\s*"\s*;/gi), "Properly uses import * as
syntax.");'
+ testString: assert(code.match(/import\s*\*\s*as\s+stringFunctions\s+from\s*('|")\.\/string_functions\.js\1/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-arrow-functions-to-write-concise-anonymous-functions.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-arrow-functions-to-write-concise-anonymous-functions.chinese.md
index 222b78c857..3ee399edf1 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-arrow-functions-to-write-concise-anonymous-functions.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-arrow-functions-to-write-concise-anonymous-functions.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 使用箭头函数编写简明的匿名函数
```yml
tests:
- text: 用户确实替换了var
关键字。
- testString: 'getUserInput => assert(!getUserInput("index").match(/var/g), "User did replace var
keyword.");'
+ testString: getUserInput => assert(!getUserInput('index').match(/var/g));
- text: magic
应该是一个常量变量(通过使用const
)。
- testString: 'getUserInput => assert(getUserInput("index").match(/const\s+magic/g), "magic
should be a constant variable (by using const
).");'
+ testString: getUserInput => assert(getUserInput('index').match(/const\s+magic/g));
- text: magic
是一种function
。
- testString: 'assert(typeof magic === "function", "magic
is a function
.");'
+ testString: assert(typeof magic === 'function');
- text: magic()
返回正确的日期。
- testString: 'assert(magic().getDate() == new Date().getDate(), "magic()
returns correct date.");'
+ testString: assert(magic().setHours(0,0,0,0) === new Date().setHours(0,0,0,0));
- text: function
关键字未使用。
- testString: 'getUserInput => assert(!getUserInput("index").match(/function/g), "function
keyword was not used.");'
+ testString: getUserInput => assert(!getUserInput('index').match(/function/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.chinese.md
index f8ffc98597..463a5dc721 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 使用类语法定义构造函数
```yml
tests:
- text: Vegetable
应该是一个class
具有限定constructor
方法。
- testString: 'assert(typeof Vegetable === "function" && typeof Vegetable.constructor === "function", "Vegetable
should be a class
with a defined constructor
method.");'
+ testString: assert(typeof Vegetable === 'function' && typeof Vegetable.constructor === 'function');
- text: class
关键字。
- testString: 'getUserInput => assert(getUserInput("index").match(/class/g),"class
keyword was used.");'
+ testString: assert(code.match(/class/g));
- text: Vegetable
可以实例化。
- testString: 'assert(() => {const a = new Vegetable("apple"); return typeof a === "object";},"Vegetable
can be instantiated.");'
+ testString: assert(() => {const a = new Vegetable("apple"); return typeof a === 'object';});
- text: carrot.name
应该返回carrot
。
- testString: 'assert(carrot.name=="carrot","carrot.name
should return carrot
.");'
+ testString: assert(carrot.name=='carrot');
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.chinese.md
index 876edcacd5..f0d90cac1d 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 使用解构分配从数组中分配变量
```yml
tests:
- text: 交换后a
值应为6。
- testString: 'assert(a === 6, "Value of a
should be 6, after swapping.");'
+ testString: assert(a === 6);
- text: 交换后b
值应为8。
- testString: 'assert(b === 8, "Value of b
should be 8, after swapping.");'
+ testString: assert(b === 8);
- text: 使用数组解构来交换a和b。
- testString: '// assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(code), "Use array destructuring to swap a and b.");'
+ testString: assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.chinese.md
index 881a688bbb..dc637e1a94 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 使用Spread运算符来就地评估数组
```yml
tests:
- text: arr2
是arr1
正确副本。
- testString: 'assert(arr2.every((v, i) => v === arr1[i]), "arr2
is correct copy of arr1
.");'
+ testString: assert(arr2.every((v, i) => v === arr1[i]));
- text: ...
传播运算符用于复制arr1
。
- testString: 'getUserInput => assert(getUserInput("index").match(/\[\s*...arr1\s*\]/g),"...
spread operator was used to duplicate arr1
.");'
+ testString: assert(code.match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/));
- text: 更改arr1
时, arr2
保持不变。
- testString: 'assert((arr1, arr2) => {arr1.push("JUN"); return arr2.length < arr1.length},"arr2
remains unchanged when arr1
is changed.");'
+ testString: assert((arr1, arr2) => {arr1.push('JUN'); return arr2.length < arr1.length});
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.chinese.md
index 2479f2bf19..7d39aeec09 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 用参数写箭头函数
```yml
tests:
- text: 用户确实替换了var
关键字。
- testString: 'getUserInput => assert(!getUserInput("index").match(/var/g), "User did replace var
keyword.");'
+ testString: getUserInput => assert(!getUserInput('index').match(/var/g));
- text: myConcat
应该是一个常量变量(使用const
)。
- testString: 'getUserInput => assert(getUserInput("index").match(/const\s+myConcat/g), "myConcat
should be a constant variable (by using const
).");'
+ testString: getUserInput => assert(getUserInput('index').match(/const\s+myConcat/g));
- text: myConcat
应该是一个函数
- testString: 'assert(typeof myConcat === "function", "myConcat
should be a function");'
+ testString: assert(typeof myConcat === 'function');
- text: myConcat()
返回正确的array
- testString: 'assert(() => { const a = myConcat([1], [2]); return a[0] == 1 && a[1] == 2; }, "myConcat()
returns the correct array
");'
+ testString: assert(() => { const a = myConcat([1], [2]); return a[0] == 1 && a[1] == 2; });
- text: function
关键字未使用。
- testString: 'getUserInput => assert(!getUserInput("index").match(/function/g), "function
keyword was not used.");'
+ testString: getUserInput => assert(!getUserInput('index').match(/function/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.chinese.md
index 465968d8d0..178c86afb2 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 用ES6编写简明的声明函数
```yml
tests:
- text: 未使用传统函数表达式。
- testString: 'assert(!getUserInput("index").match(/function/),"Traditional function
expression was not used.");'
+ testString: getUserInput => assert(!removeJSComments(code).match(/function/));
- text: setGear
是一个声明函数。
- testString: 'assert(typeof bicycle.setGear === "function" && getUserInput("index").match(/setGear\s*\(.+\)\s*\{/), "setGear
is a declarative function.");'
- - text: ''
- testString: 'assert((new bicycle.setGear(48)).gear === 48, "bicycle.setGear(48)
changes the gear
value to 48.");'
+ testString: assert(typeof bicycle.setGear === 'function' && code.match(/setGear\s*\(.+\)\s*\{/));
+ - text: bicycle.setGear(48)
应该返回48。
+ testString: assert((new bicycle.setGear(48)).gear === 48);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-simple-fields.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-simple-fields.chinese.md
index d61b3be390..1591d6cfa5 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-simple-fields.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-simple-fields.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用简单字段编写简明对象文字声明
```yml
tests:
- text: '输出是{name: "Zodiac Hasbro", age: 56, gender: "male"}
。'
- testString: 'assert(() => {const res={name:"Zodiac Hasbro",age:56,gender:"male"}; const person=createPerson("Zodiac Hasbro", 56, "male"); return Object.keys(person).every(k => person[k] === res[k]);}, "the output is {name: "Zodiac Hasbro", age: 56, gender: "male"}
.");'
+ testString: assert(() => {const res={name:"Zodiac Hasbro",age:56,gender:"male"}; const person=createPerson("Zodiac Hasbro", 56, "male"); return Object.keys(person).every(k => person[k] === res[k]);});
- text: '不:
被使用了。'
- testString: 'getUserInput => assert(!getUserInput("index").match(/:/g), "No :
were used.");'
+ testString: getUserInput => assert(!getUserInput("index").match(/:/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.chinese.md
index 1be8e2801a..b98550436f 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 使用concat将元素添加到数组的末尾而不是push
```yml
tests:
- text: 您的代码应使用concat
方法。
- testString: 'assert(code.match(/\.concat/g), "Your code should use the concat
method.");'
+ testString: assert(code.match(/\.concat/g));
- text: 您的代码不应使用push
方法。
- testString: 'assert(!code.match(/\.push/g), "Your code should not use the push
method.");'
+ testString: assert(!code.match(/\.push/g));
- text: 第first
数组不应该改变。
- testString: 'assert(JSON.stringify(first) === JSON.stringify([1, 2, 3]), "The first
array should not change.");'
+ testString: assert(JSON.stringify(first) === JSON.stringify([1, 2, 3]));
- text: second
数组不应该改变。
- testString: 'assert(JSON.stringify(second) === JSON.stringify([4, 5]), "The second
array should not change.");'
+ testString: assert(JSON.stringify(second) === JSON.stringify([4, 5]));
- text: 'nonMutatingPush([1, 2, 3], [4, 5])
应该返回[1, 2, 3, 4, 5]
。'
- testString: 'assert(JSON.stringify(nonMutatingPush([1, 2, 3], [4, 5])) === JSON.stringify([1, 2, 3, 4, 5]), "nonMutatingPush([1, 2, 3], [4, 5])
should return [1, 2, 3, 4, 5]
.");'
+ testString: assert(JSON.stringify(nonMutatingPush([1, 2, 3], [4, 5])) === JSON.stringify([1, 2, 3, 4, 5]));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.chinese.md
index fae2109e3a..95a9b0c39b 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.chinese.md
@@ -18,17 +18,17 @@ localeTitle: 应用函数式编程将字符串转换为URL Slugs
```yml
tests:
- text: globalTitle
变量不应该更改。
- testString: 'assert(globalTitle === "Winter Is Coming", "The globalTitle
variable should not change.");'
+ testString: assert(globalTitle === "Winter Is Coming");
- text: 您的代码不应使用replace
方法来应对此挑战。
- testString: 'assert(!code.match(/\.replace/g), "Your code should not use the replace
method for this challenge.");'
+ testString: assert(!code.match(/\.replace/g));
- text: urlSlug("Winter Is Coming")
应该回归"winter-is-coming"
。
- testString: 'assert(urlSlug("Winter Is Coming") === "winter-is-coming", "urlSlug("Winter Is Coming")
should return "winter-is-coming"
.");'
+ testString: assert(urlSlug("Winter Is Coming") === "winter-is-coming");
- text: urlSlug(" Winter Is Coming")
应该回归"winter-is-coming"
。
- testString: 'assert(urlSlug(" Winter Is Coming") === "winter-is-coming", "urlSlug(" Winter Is Coming")
should return "winter-is-coming"
.");'
+ testString: assert(urlSlug(" Winter Is Coming") === "winter-is-coming");
- text: urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone")
应该回归"a-mind-needs-books-like-a-sword-needs-a-whetstone"
。
- testString: 'assert(urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone") === "a-mind-needs-books-like-a-sword-needs-a-whetstone", "urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone")
should return "a-mind-needs-books-like-a-sword-needs-a-whetstone"
.");'
+ testString: assert(urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone") === "a-mind-needs-books-like-a-sword-needs-a-whetstone");
- text: urlSlug("Hold The Door")
应该返回"hold-the-door"
。
- testString: 'assert(urlSlug("Hold The Door") === "hold-the-door", "urlSlug("Hold The Door")
should return "hold-the-door"
.");'
+ testString: assert(urlSlug("Hold The Door") === "hold-the-door");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/avoid-mutations-and-side-effects-using-functional-programming.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/avoid-mutations-and-side-effects-using-functional-programming.chinese.md
index dc21c97ede..09843cd355 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/avoid-mutations-and-side-effects-using-functional-programming.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/avoid-mutations-and-side-effects-using-functional-programming.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用功能编程避免突变和副作用
```yml
tests:
- text: 您的函数incrementer
不应更改fixedValue
的值。
- testString: 'assert(fixedValue === 4, "Your function incrementer
should not change the value of fixedValue
.");'
+ testString: assert(fixedValue === 4);
- text: 您的incrementer
函数应返回一个大于fixedValue
值的值。
- testString: 'assert(newValue === 5, "Your incrementer
function should return a value that is one larger than the fixedValue
value.");'
+ testString: assert(newValue === 5);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.chinese.md
index e58ba5df74..749106dfb5 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.chinese.md
@@ -18,17 +18,17 @@ localeTitle: 使用join方法将Array组合成String
```yml
tests:
- text: 您的代码应使用join
方法。
- testString: 'assert(code.match(/\.join/g), "Your code should use the join
method.");'
+ testString: assert(code.match(/\.join/g));
- text: 您的代码不应使用replace
方法。
- testString: 'assert(!code.match(/\.replace/g), "Your code should not use the replace
method.");'
+ testString: assert(!code.match(/\.replace/g));
- text: sentensify("May-the-force-be-with-you")
应该返回一个字符串。
- testString: 'assert(typeof sentensify("May-the-force-be-with-you") === "string", "sentensify("May-the-force-be-with-you")
should return a string.");'
+ testString: assert(typeof sentensify("May-the-force-be-with-you") === "string");
- text: sentensify("May-the-force-be-with-you")
应该返回"May the force be with you"
。
- testString: 'assert(sentensify("May-the-force-be-with-you") === "May the force be with you", "sentensify("May-the-force-be-with-you")
should return "May the force be with you"
.");'
+ testString: assert(sentensify("May-the-force-be-with-you") === "May the force be with you");
- text: sentensify("The.force.is.strong.with.this.one")
应该返回"The force is strong with this one"
。
- testString: 'assert(sentensify("The.force.is.strong.with.this.one") === "The force is strong with this one", "sentensify("The.force.is.strong.with.this.one")
should return "The force is strong with this one"
.");'
+ testString: assert(sentensify("The.force.is.strong.with.this.one") === "The force is strong with this one");
- text: 'sentensify("There,has,been,an,awakening")
应该回归"There has been an awakening"
。'
- testString: 'assert(sentensify("There,has,been,an,awakening") === "There has been an awakening", "sentensify("There,has,been,an,awakening")
should return "There has been an awakening"
.");'
+ testString: assert(sentensify("There,has,been,an,awakening") === "There has been an awakening");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.chinese.md
index 10902d1514..618e769f4e 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 使用concat方法组合两个数组
```yml
tests:
- text: 您的代码应使用concat
方法。
- testString: 'assert(code.match(/\.concat/g), "Your code should use the concat
method.");'
+ testString: assert(code.match(/\.concat/g));
- text: 第first
数组不应该改变。
- testString: 'assert(JSON.stringify(first) === JSON.stringify([1, 2, 3]), "The first
array should not change.");'
+ testString: assert(JSON.stringify(first) === JSON.stringify([1, 2, 3]));
- text: second
数组不应该改变。
- testString: 'assert(JSON.stringify(second) === JSON.stringify([4, 5]), "The second
array should not change.");'
+ testString: assert(JSON.stringify(second) === JSON.stringify([4, 5]));
- text: 'nonMutatingConcat([1, 2, 3], [4, 5])
应该返回[1, 2, 3, 4, 5]
。'
- testString: 'assert(JSON.stringify(nonMutatingConcat([1, 2, 3], [4, 5])) === JSON.stringify([1, 2, 3, 4, 5]), "nonMutatingConcat([1, 2, 3], [4, 5])
should return [1, 2, 3, 4, 5]
.");'
+ testString: assert(JSON.stringify(nonMutatingConcat([1, 2, 3], [4, 5])) === JSON.stringify([1, 2, 3, 4, 5]));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.chinese.md
index 992d929e51..682505ed01 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 在Prototype上实现地图
```yml
tests:
- text: 'new_s
应该等于[46, 130, 196, 10]
new_s
[46, 130, 196, 10]
。'
- testString: 'assert(JSON.stringify(new_s) === JSON.stringify([46, 130, 196, 10]), "new_s
should equal [46, 130, 196, 10]
.");'
+ testString: assert(JSON.stringify(new_s) === JSON.stringify([46, 130, 196, 10]));
- text: 您的代码不应使用map
方法。
- testString: 'assert(!code.match(/\.map/g), "Your code should not use the map
method.");'
+ testString: assert(!code.match(/\.map/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.chinese.md
index a36c8e1a09..20759e016d 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 在Prototype上实现过滤器方法
```yml
tests:
- text: 'new_s
应该等于[23, 65, 5]
new_s
[23, 65, 5]
。'
- testString: 'assert(JSON.stringify(new_s) === JSON.stringify([23, 65, 5]), "new_s
should equal [23, 65, 5]
.");'
+ testString: assert(JSON.stringify(new_s) === JSON.stringify([23, 65, 5]));
- text: 您的代码不应使用filter
方法。
- testString: 'assert(!code.match(/\.filter/g), "Your code should not use the filter
method.");'
+ testString: assert(!code.match(/\.filter/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.chinese.md
index f0e0bdde3f..bbaa5c9044 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.chinese.md
@@ -18,13 +18,13 @@ localeTitle: Currying和Partial Application简介
```yml
tests:
- text: add(10)(20)(30)
应该返回60
。
- testString: 'assert(add(10)(20)(30) === 60, "add(10)(20)(30)
should return 60
.");'
+ testString: assert(add(10)(20)(30) === 60);
- text: add(1)(2)(3)
应该返回6
。
- testString: 'assert(add(1)(2)(3) === 6, "add(1)(2)(3)
should return 6
.");'
+ testString: assert(add(1)(2)(3) === 6);
- text: add(11)(22)(33)
应该返回66
。
- testString: 'assert(add(11)(22)(33) === 66, "add(11)(22)(33)
should return 66
.");'
+ testString: assert(add(11)(22)(33) === 66);
- text: 您的代码应包含返回x + y + z
的final语句。
- testString: 'assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g), "Your code should include a final statement that returns x + y + z
.");'
+ testString: assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/learn-about-functional-programming.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/learn-about-functional-programming.chinese.md
index 6a482a6b38..4c877f723e 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/learn-about-functional-programming.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/learn-about-functional-programming.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 了解功能编程
```yml
tests:
- text: tea4TeamFCC
变量应该为团队提供40杯茶。
- testString: 'assert(tea4TeamFCC.length === 40, "The tea4TeamFCC
variable should hold 40 cups of tea for the team.");'
+ testString: assert(tea4TeamFCC.length === 40);
- text: tea4TeamFCC
变量应该拿着一杯绿茶。
- testString: 'assert(tea4TeamFCC[0] === "greenTea", "The tea4TeamFCC
variable should hold cups of green tea.");'
+ testString: assert(tea4TeamFCC[0] === 'greenTea');
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.chinese.md
index accf10532a..5ef7985478 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 传递参数以避免函数中的外部依赖
```yml
tests:
- text: 您的函数incrementer
不应更改fixedValue
的值。
- testString: 'assert(fixedValue === 4, "Your function incrementer
should not change the value of fixedValue
.");'
+ testString: assert(fixedValue === 4);
- text: 您的incrementer
功能应该采用参数。
- testString: 'assert(code.match(/function\s+?incrementer\s*?\(.+?\)/g), "Your incrementer
function should take a parameter.");'
+ testString: assert(incrementer.length === 1);
- text: 您的incrementer
函数应返回一个大于fixedValue
值的值。
- testString: 'assert(newValue === 5, "Your incrementer
function should return a value that is one larger than the fixedValue
value.");'
+ testString: assert(newValue === 5);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.chinese.md
index 1d12327938..f7f136f316 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 重构函数的全局变量
```yml
tests:
- text: 'bookList
不应该改变并且仍然相等["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]
。'
- testString: 'assert(JSON.stringify(bookList) === JSON.stringify(["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]), "bookList
should not change and still equal ["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]
.");'
+ 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: 'newBookList
应该等于["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]
。'
- 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"]), "newBookList
should equal ["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]
.");'
+ 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: 'newerBookList
应该等于["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]
。'
- testString: 'assert(JSON.stringify(newerBookList) === JSON.stringify(["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]), "newerBookList
should equal ["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]
.");'
+ testString: assert(JSON.stringify(newerBookList) === JSON.stringify(['The Hound of the Baskervilles', 'Philosophiæ Naturalis Principia Mathematica', 'Disquisitiones Arithmeticae']));
- text: 'newestBookList
应该等于["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]
。'
- testString: 'assert(JSON.stringify(newestBookList) === JSON.stringify(["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]), "newestBookList
should equal ["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]
.");'
+ testString: assert(JSON.stringify(newestBookList) === JSON.stringify(['The Hound of the Baskervilles', 'Philosophiæ Naturalis Principia Mathematica', 'Disquisitiones Arithmeticae', 'A Brief History of Time']));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.chinese.md
index 84b927b73a..d681a82e9b 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 使用切片从阵列中删除元素而不是拼接
```yml
tests:
- text: 您的代码应该使用slice
方法。
- testString: 'assert(code.match(/\.slice/g), "Your code should use the slice
method.");'
+ testString: assert(code.match(/\.slice/g));
- text: 您的代码不应使用splice
方法。
- testString: 'assert(!code.match(/\.splice/g), "Your code should not use the splice
method.");'
+ testString: assert(!code.match(/\.splice/g));
- text: inputCities
数组不应更改。
- testString: 'assert(JSON.stringify(inputCities) === JSON.stringify(["Chicago", "Delhi", "Islamabad", "London", "Berlin"]), "The inputCities
array should not change.");'
+ testString: assert(JSON.stringify(inputCities) === JSON.stringify(["Chicago", "Delhi", "Islamabad", "London", "Berlin"]));
- text: 'nonMutatingSplice(["Chicago", "Delhi", "Islamabad", "London", "Berlin"])
应该返回["Chicago", "Delhi", "Islamabad"]
。'
- testString: 'assert(JSON.stringify(nonMutatingSplice(["Chicago", "Delhi", "Islamabad", "London", "Berlin"])) === JSON.stringify(["Chicago", "Delhi", "Islamabad"]), "nonMutatingSplice(["Chicago", "Delhi", "Islamabad", "London", "Berlin"])
should return ["Chicago", "Delhi", "Islamabad"]
.");'
+ testString: assert(JSON.stringify(nonMutatingSplice(["Chicago", "Delhi", "Islamabad", "London", "Berlin"])) === JSON.stringify(["Chicago", "Delhi", "Islamabad"]));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.chinese.md
index 474c9b94c5..311a2847a8 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 返回排序数组而不更改原始数组
```yml
tests:
- text: 您的代码应该使用sort
方法。
- testString: 'assert(code.match(/\.sort/g), "Your code should use the sort
method.");'
+ testString: assert(nonMutatingSort.toString().match(/\.sort/g));
- text: 您的代码应使用concat
方法。
- testString: 'assert(code.match(/\.concat/g), "Your code should use the concat
method.");'
+ testString: assert(JSON.stringify(globalArray) === JSON.stringify([5, 6, 3, 2, 9]));
- text: globalArray
变量不应该更改。
- testString: 'assert(JSON.stringify(globalArray) === JSON.stringify([5, 6, 3, 2, 9]), "The globalArray
variable should not change.");'
+ testString: assert(JSON.stringify(nonMutatingSort(globalArray)) === JSON.stringify([2, 3, 5, 6, 9]));
- text: 'nonMutatingSort(globalArray)
应该返回[2, 3, 5, 6, 9]
nonMutatingSort(globalArray)
[2, 3, 5, 6, 9]
。'
- testString: 'assert(JSON.stringify(nonMutatingSort(globalArray)) === JSON.stringify([2, 3, 5, 6, 9]), "nonMutatingSort(globalArray)
should return [2, 3, 5, 6, 9]
.");'
+ testString: assert(!nonMutatingSort.toString().match(/[23569]/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.chinese.md
index 63abf20522..33aafab51a 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 使用切片方法返回数组的一部分
```yml
tests:
- text: 您的代码应该使用slice
方法。
- testString: 'assert(code.match(/\.slice/g), "Your code should use the slice
method.");'
+ testString: assert(code.match(/\.slice/g));
- text: inputAnim
变量不应该更改。
- testString: 'assert(JSON.stringify(inputAnim) === JSON.stringify(["Cat", "Dog", "Tiger", "Zebra", "Ant"]), "The inputAnim
variable should not change.");'
+ testString: assert(JSON.stringify(inputAnim) === JSON.stringify(["Cat", "Dog", "Tiger", "Zebra", "Ant"]));
- text: 'sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 3)
应该返回["Dog", "Tiger"]
。'
- testString: 'assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 3)) === JSON.stringify(["Dog", "Tiger"]), "sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 3)
should return ["Dog", "Tiger"]
.");'
+ testString: assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 3)) === JSON.stringify(["Dog", "Tiger"]));
- text: 'sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 0, 1)
应返回["Cat"]
。'
- testString: 'assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 0, 1)) === JSON.stringify(["Cat"]), "sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 0, 1)
should return ["Cat"]
.");'
+ testString: assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 0, 1)) === JSON.stringify(["Cat"]));
- text: 'sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 4)
应返回["Dog", "Tiger", "Zebra"]
。'
- testString: 'assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 4)) === JSON.stringify(["Dog", "Tiger", "Zebra"]), "sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 4)
should return ["Dog", "Tiger", "Zebra"]
.");'
+ testString: assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 4)) === JSON.stringify(["Dog", "Tiger", "Zebra"]));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.chinese.md
index fefb531bc2..2c011c1d39 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 使用sort方法按字母顺序对数组进行排序
```yml
tests:
- text: 您的代码应该使用sort
方法。
- testString: 'assert(code.match(/\.sort/g), "Your code should use the sort
method.");'
+ testString: assert(code.match(/\.sort/g));
- text: 'alphabeticalOrder(["a", "d", "c", "a", "z", "g"])
应返回["a", "a", "c", "d", "g", "z"]
。'
- testString: 'assert(JSON.stringify(alphabeticalOrder(["a", "d", "c", "a", "z", "g"])) === JSON.stringify(["a", "a", "c", "d", "g", "z"]), "alphabeticalOrder(["a", "d", "c", "a", "z", "g"])
should return ["a", "a", "c", "d", "g", "z"]
.");'
+ testString: assert(JSON.stringify(alphabeticalOrder(["a", "d", "c", "a", "z", "g"])) === JSON.stringify(["a", "a", "c", "d", "g", "z"]));
- text: 'alphabeticalOrder(["x", "h", "a", "m", "n", "m"])
应返回["a", "h", "m", "m", "n", "x"]
。'
- testString: 'assert(JSON.stringify(alphabeticalOrder(["x", "h", "a", "m", "n", "m"])) === JSON.stringify(["a", "h", "m", "m", "n", "x"]), "alphabeticalOrder(["x", "h", "a", "m", "n", "m"])
should return ["a", "h", "m", "m", "n", "x"]
.");'
+ testString: assert(JSON.stringify(alphabeticalOrder(["x", "h", "a", "m", "n", "m"])) === JSON.stringify(["a", "h", "m", "m", "n", "x"]));
- text: 'alphabeticalOrder(["a", "a", "a", "a", "x", "t"])
应返回["a", "a", "a", "a", "t", "x"]
。'
- testString: 'assert(JSON.stringify(alphabeticalOrder(["a", "a", "a", "a", "x", "t"])) === JSON.stringify(["a", "a", "a", "a", "t", "x"]), "alphabeticalOrder(["a", "a", "a", "a", "x", "t"])
should return ["a", "a", "a", "a", "t", "x"]
.");'
+ testString: assert(JSON.stringify(alphabeticalOrder(["a", "a", "a", "a", "x", "t"])) === JSON.stringify(["a", "a", "a", "a", "t", "x"]));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.chinese.md
index 6966db0e01..31b8be007f 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 使用split方法将字符串拆分为数组
```yml
tests:
- text: 您的代码应该使用split
方法。
- testString: 'assert(code.match(/\.split/g), "Your code should use the split
method.");'
+ testString: assert(code.match(/\.split/g));
- text: 'splitify("Hello World,I-am code")
应返回["Hello", "World", "I", "am", "code"]
。'
- testString: 'assert(JSON.stringify(splitify("Hello World,I-am code")) === JSON.stringify(["Hello", "World", "I", "am", "code"]), "splitify("Hello World,I-am code")
should return ["Hello", "World", "I", "am", "code"]
.");'
+ testString: assert(JSON.stringify(splitify("Hello World,I-am code")) === JSON.stringify(["Hello", "World", "I", "am", "code"]));
- text: 'splitify("Earth-is-our home")
应该返回["Earth", "is", "our", "home"]
。'
- testString: 'assert(JSON.stringify(splitify("Earth-is-our home")) === JSON.stringify(["Earth", "is", "our", "home"]), "splitify("Earth-is-our home")
should return ["Earth", "is", "our", "home"]
.");'
+ testString: assert(JSON.stringify(splitify("Earth-is-our home")) === JSON.stringify(["Earth", "is", "our", "home"]));
- text: 'splitify("This.is.a-sentence")
应该返回["This", "is", "a", "sentence"]
。'
- testString: 'assert(JSON.stringify(splitify("This.is.a-sentence")) === JSON.stringify(["This", "is", "a", "sentence"]), "splitify("This.is.a-sentence")
should return ["This", "is", "a", "sentence"]
.");'
+ testString: assert(JSON.stringify(splitify("This.is.a-sentence")) === JSON.stringify(["This", "is", "a", "sentence"]));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/understand-functional-programming-terminology.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/understand-functional-programming-terminology.chinese.md
index 80c61aa166..80759fb581 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/understand-functional-programming-terminology.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/understand-functional-programming-terminology.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 理解功能编程术语
```yml
tests:
- text: tea4GreenTeamFCC
变量应该为团队提供27杯绿茶。
- testString: 'assert(tea4GreenTeamFCC.length === 27, "The tea4GreenTeamFCC
variable should hold 27 cups of green tea for the team.");'
+ testString: assert(tea4GreenTeamFCC.length === 27);
- text: tea4GreenTeamFCC
变量应该拿着一杯绿茶。
- testString: 'assert(tea4GreenTeamFCC[0] === "greenTea", "The tea4GreenTeamFCC
variable should hold cups of green tea.");'
+ testString: assert(tea4GreenTeamFCC[0] === 'greenTea');
- text: tea4BlackTeamFCC
变量应该可以容纳13杯红茶。
- testString: 'assert(tea4BlackTeamFCC.length === 13, "The tea4BlackTeamFCC
variable should hold 13 cups of black tea.");'
+ testString: assert(tea4BlackTeamFCC.length === 13);
- text: tea4BlackTeamFCC
变量应该拿着一杯红茶。
- testString: 'assert(tea4BlackTeamFCC[0] === "blackTea", "The tea4BlackTeamFCC
variable should hold cups of black tea.");'
+ testString: assert(tea4BlackTeamFCC[0] === 'blackTea');
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/understand-the-hazards-of-using-imperative-code.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/understand-the-hazards-of-using-imperative-code.chinese.md
index 595fc6b8ce..c74c102f44 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/understand-the-hazards-of-using-imperative-code.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/understand-the-hazards-of-using-imperative-code.chinese.md
@@ -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'])
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.chinese.md
index 7ebb60392c..24384b031c 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 使用every方法检查数组中的每个元素是否符合条件
```yml
tests:
- text: 您的代码应该使用every
方法。
- testString: 'assert(code.match(/\.every/g), "Your code should use the every
method.");'
+ testString: assert(code.match(/\.every/g));
- text: 'checkPositive([1, 2, 3, -4, 5])
应该返回false
。'
- testString: 'assert(!checkPositive([1, 2, 3, -4, 5]), "checkPositive([1, 2, 3, -4, 5])
should return false
.");'
+ testString: assert.isFalse(checkPositive([1, 2, 3, -4, 5]));
- text: 'checkPositive([1, 2, 3, 4, 5])
应该返回true
。'
- testString: 'assert(checkPositive([1, 2, 3, 4, 5]), "checkPositive([1, 2, 3, 4, 5])
should return true
.");'
+ testString: assert.isTrue(checkPositive([1, 2, 3, 4, 5]));
- text: 'checkPositive([1, -2, 3, -4, 5])
应该返回false
。'
- testString: 'assert(!checkPositive([1, -2, 3, -4, 5]), "checkPositive([1, -2, 3, -4, 5])
should return false
.");'
+ testString: assert.isFalse(checkPositive([1, -2, 3, -4, 5]));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.chinese.md
index 78e052c155..22a0bb5094 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 使用过滤器方法从数组中提取数据
```yml
tests:
- text: watchList
变量不应该更改。
- testString: 'assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron", "The watchList
variable should not change.");'
+ testString: assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron");
- text: 您的代码应该使用filter
方法。
- testString: 'assert(code.match(/\.filter/g), "Your code should use the filter
method.");'
+ testString: assert(code.match(/\.filter/g));
- text: 您的代码不应使用for
循环。
- testString: 'assert(!code.match(/for\s*?\(.+?\)/g), "Your code should not use a for
loop.");'
+ testString: assert(!code.match(/for\s*?\([\s\S]*?\)/g));
- text: 'filteredList
应该等于[{"title": "Inception","rating": "8.8"},{"title": "Interstellar","rating": "8.6"},{"title": "The Dark Knight","rating": "9.0"},{"title": "Batman Begins","rating": "8.3"}]
。'
- 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"}], "filteredList
should equal [{"title": "Inception","rating": "8.8"},{"title": "Interstellar","rating": "8.6"},{"title": "The Dark Knight","rating": "9.0"},{"title": "Batman Begins","rating": "8.3"}]
.");'
+ 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"}]);'
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.chinese.md
index ede2166ef8..8f6112aab7 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 使用映射方法从数组中提取数据
```yml
tests:
- text: watchList
变量不应该更改。
- testString: 'assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron", "The watchList
variable should not change.");'
+ testString: assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron");
- text: 您的代码不应使用for
循环。
- testString: 'assert(!code.match(/for\s*?\(.+?\)/g), "Your code should not use a for
loop.");'
+ testString: assert(!removeJSComments(code).match(/for\s*?\([\s\S]*?\)/));
- text: 您的代码应该使用map
方法。
- testString: 'assert(code.match(/\.map/g), "Your code should use the map
method.");'
+ testString: assert(code.match(/\.map/g));
- text: 'rating
应该等于[{"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"}]
。'
- 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"}]), "rating
should equal [{"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"}]
.");'
+ 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"}]);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.chinese.md
index bd01735eb0..06eed8fa19 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 使用某些方法检查阵列中的任何元素是否符合条件
```yml
tests:
- text: 您的代码应该使用some
方法。
- testString: 'assert(code.match(/\.some/g), "Your code should use the some
method.");'
+ testString: assert(code.match(/\.some/g));
- text: 'checkPositive([1, 2, 3, -4, 5])
应该返回true
。'
- testString: 'assert(checkPositive([1, 2, 3, -4, 5]), "checkPositive([1, 2, 3, -4, 5])
should return true
.");'
+ testString: assert(checkPositive([1, 2, 3, -4, 5]));
- text: 'checkPositive([1, 2, 3, 4, 5])
应该返回true
。'
- testString: 'assert(checkPositive([1, 2, 3, 4, 5]), "checkPositive([1, 2, 3, 4, 5])
should return true
.");'
+ testString: assert(checkPositive([1, 2, 3, 4, 5]));
- text: 'checkPositive([-1, -2, -3, -4, -5])
应该返回false
。'
- testString: 'assert(!checkPositive([-1, -2, -3, -4, -5]), "checkPositive([-1, -2, -3, -4, -5])
should return false
.");'
+ testString: assert(!checkPositive([-1, -2, -3, -4, -5]));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/arguments-optional.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/arguments-optional.chinese.md
index 8e77ce1d07..934b8e13bf 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/arguments-optional.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/arguments-optional.chinese.md
@@ -20,15 +20,15 @@ localeTitle: 参数可选
```yml
tests:
- text: 'addTogether(2, 3)
应该返回5。'
- testString: 'assert.deepEqual(addTogether(2, 3), 5, "addTogether(2, 3)
should return 5.");'
+ testString: assert.deepEqual(addTogether(2, 3), 5);
- text: addTogether(2)(3)
应该返回5。
- testString: 'assert.deepEqual(addTogether(2)(3), 5, "addTogether(2)(3)
should return 5.");'
+ testString: assert.deepEqual(addTogether(2)(3), 5);
- text: 'addTogether("http://bit.ly/IqT6zt")
应返回undefined。'
- testString: 'assert.isUndefined(addTogether("http://bit.ly/IqT6zt"), "addTogether("http://bit.ly/IqT6zt")
should return undefined.");'
+ testString: assert.isUndefined(addTogether("http://bit.ly/IqT6zt"));
- text: 'addTogether(2, "3")
应返回undefined。'
- testString: 'assert.isUndefined(addTogether(2, "3"), "addTogether(2, "3")
should return undefined.");'
+ testString: assert.isUndefined(addTogether(2, "3"));
- text: 'addTogether(2)([3])
应返回undefined。'
- testString: 'assert.isUndefined(addTogether(2)([3]), "addTogether(2)([3])
should return undefined.");'
+ testString: assert.isUndefined(addTogether(2)([3]));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/binary-agents.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/binary-agents.chinese.md
index cea29d9deb..126da19ec7 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/binary-agents.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/binary-agents.chinese.md
@@ -20,9 +20,9 @@ localeTitle: 二元代理商
```yml
tests:
- text: binaryAgent("01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111")
应该返回“不是篝火有趣!?”
- testString: 'assert.deepEqual(binaryAgent("01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111"), "Aren"t bonfires fun!?", "binaryAgent("01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111")
should return "Aren't bonfires fun!?"");'
+ testString: assert.deepEqual(binaryAgent('01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111'), "Aren't bonfires fun!?");
- text: binaryAgent("01001001 00100000 01101100 01101111 01110110 01100101 00100000 01000110 01110010 01100101 01100101 01000011 01101111 01100100 01100101 01000011 01100001 01101101 01110000 00100001")
应返回“我爱FreeCodeCamp!”
- testString: 'assert.deepEqual(binaryAgent("01001001 00100000 01101100 01101111 01110110 01100101 00100000 01000110 01110010 01100101 01100101 01000011 01101111 01100100 01100101 01000011 01100001 01101101 01110000 00100001"), "I love FreeCodeCamp!", "binaryAgent("01001001 00100000 01101100 01101111 01110110 01100101 00100000 01000110 01110010 01100101 01100101 01000011 01101111 01100100 01100101 01000011 01100001 01101101 01110000 00100001")
should return "I love FreeCodeCamp!"");'
+ testString: assert.deepEqual(binaryAgent('01001001 00100000 01101100 01101111 01110110 01100101 00100000 01000110 01110010 01100101 01100101 01000011 01101111 01100100 01100101 01000011 01100001 01101101 01110000 00100001'), "I love FreeCodeCamp!");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/convert-html-entities.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/convert-html-entities.chinese.md
index d6d2a498bb..bac820e06f 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/convert-html-entities.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/convert-html-entities.chinese.md
@@ -20,19 +20,19 @@ localeTitle: 转换HTML实体
```yml
tests:
- text: convertHTML("Dolce & Gabbana")
应该返回Dolce & Gabbana
。
- testString: 'assert.match(convertHTML("Dolce & Gabbana"), /Dolce & Gabbana/, "convertHTML("Dolce & Gabbana")
should return Dolce & Gabbana
.");'
+ testString: assert.match(convertHTML("Dolce & Gabbana"), /Dolce & Gabbana/);
- text: convertHTML("Hamburgers < Pizza < Tacos")
应该返回Hamburgers < Pizza < Tacos
。
- testString: 'assert.match(convertHTML("Hamburgers < Pizza < Tacos"), /Hamburgers < Pizza < Tacos/, "convertHTML("Hamburgers < Pizza < Tacos")
should return Hamburgers < Pizza < Tacos
.");'
+ testString: assert.match(convertHTML("Hamburgers < Pizza < Tacos"), /Hamburgers < Pizza < Tacos/);
- text: convertHTML("Sixty > twelve")
应返回Sixty > twelve
。
- testString: 'assert.match(convertHTML("Sixty > twelve"), /Sixty > twelve/, "convertHTML("Sixty > twelve")
should return Sixty > twelve
.");'
+ testString: assert.match(convertHTML("Sixty > twelve"), /Sixty > twelve/);
- text: 'convertHTML('Stuff in "quotation marks"')
应该convertHTML('Stuff in "quotation marks"')
返回Stuff in "quotation marks"
。'
- testString: 'assert.match(convertHTML("Stuff in "quotation marks""), /Stuff in "quotation marks"/, "convertHTML('Stuff in "quotation marks"')
should return Stuff in "quotation marks"
.");'
+ testString: assert.match(convertHTML('Stuff in "quotation marks"'), /Stuff in "quotation marks"/);
- text: 'convertHTML("Schindler's List")
应该返回Schindler's List
。'
- testString: 'assert.match(convertHTML("Schindler"s List"), /Schindler's List/, "convertHTML("Schindler's List")
should return Schindler's List
.");'
+ testString: assert.match(convertHTML("Schindler's List"), /Schindler's List/);
- text: convertHTML("<>")
应返回<>
。
- testString: 'assert.match(convertHTML("<>"), /<>/, "convertHTML("<>")
should return <>
.");'
+ testString: assert.match(convertHTML('<>'), /<>/);
- text: convertHTML("abc")
应该返回abc
。
- testString: 'assert.strictEqual(convertHTML("abc"), "abc", "convertHTML("abc")
should return abc
.");'
+ testString: assert.strictEqual(convertHTML('abc'), 'abc');
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/diff-two-arrays.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/diff-two-arrays.chinese.md
index 717743dbb6..ae3b577458 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/diff-two-arrays.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/diff-two-arrays.chinese.md
@@ -20,35 +20,35 @@ localeTitle: 差分两个阵列
```yml
tests:
- text: 'diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5])
应该返回一个数组。'
- testString: 'assert(typeof diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]) === "object", "diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5])
should return an array.");'
+ testString: assert(typeof diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]) === "object");
- text: '["diorite", "andesite", "grass", "dirt", "pink wool", "dead shrub"], ["diorite", "andesite", "grass", "dirt", "dead shrub"]
应该返回["pink wool"]
。'
- testString: 'assert.sameMembers(diffArray(["diorite", "andesite", "grass", "dirt", "pink wool", "dead shrub"], ["diorite", "andesite", "grass", "dirt", "dead shrub"]), ["pink wool"], "["diorite", "andesite", "grass", "dirt", "pink wool", "dead shrub"], ["diorite", "andesite", "grass", "dirt", "dead shrub"]
should return ["pink wool"]
.");'
+ testString: assert.sameMembers(diffArray(["diorite", "andesite", "grass", "dirt", "pink wool", "dead shrub"], ["diorite", "andesite", "grass", "dirt", "dead shrub"]), ["pink wool"]);
- text: '["diorite", "andesite", "grass", "dirt", "pink wool", "dead shrub"], ["diorite", "andesite", "grass", "dirt", "dead shrub"]
应该返回一个包含一个项目的数组。'
- testString: 'assert(diffArray(["diorite", "andesite", "grass", "dirt", "pink wool", "dead shrub"], ["diorite", "andesite", "grass", "dirt", "dead shrub"]).length === 1, "["diorite", "andesite", "grass", "dirt", "pink wool", "dead shrub"], ["diorite", "andesite", "grass", "dirt", "dead shrub"]
should return an array with one item.");'
+ testString: assert(diffArray(["diorite", "andesite", "grass", "dirt", "pink wool", "dead shrub"], ["diorite", "andesite", "grass", "dirt", "dead shrub"]).length === 1);
- text: '["andesite", "grass", "dirt", "pink wool", "dead shrub"], ["diorite", "andesite", "grass", "dirt", "dead shrub"]
应该返回["diorite", "pink wool"]
。'
- testString: 'assert.sameMembers(diffArray(["andesite", "grass", "dirt", "pink wool", "dead shrub"], ["diorite", "andesite", "grass", "dirt", "dead shrub"]), ["diorite", "pink wool"], "["andesite", "grass", "dirt", "pink wool", "dead shrub"], ["diorite", "andesite", "grass", "dirt", "dead shrub"]
should return ["diorite", "pink wool"]
.");'
+ testString: assert.sameMembers(diffArray(["andesite", "grass", "dirt", "pink wool", "dead shrub"], ["diorite", "andesite", "grass", "dirt", "dead shrub"]), ["diorite", "pink wool"]);
- text: '["andesite", "grass", "dirt", "pink wool", "dead shrub"], ["diorite", "andesite", "grass", "dirt", "dead shrub"]
应该返回一个数组有两个项目。'
- testString: 'assert(diffArray(["andesite", "grass", "dirt", "pink wool", "dead shrub"], ["diorite", "andesite", "grass", "dirt", "dead shrub"]).length === 2, "["andesite", "grass", "dirt", "pink wool", "dead shrub"], ["diorite", "andesite", "grass", "dirt", "dead shrub"]
should return an array with two items.");'
+ testString: assert(diffArray(["andesite", "grass", "dirt", "pink wool", "dead shrub"], ["diorite", "andesite", "grass", "dirt", "dead shrub"]).length === 2);
- text: '["andesite", "grass", "dirt", "dead shrub"], ["andesite", "grass", "dirt", "dead shrub"]
应该返回[]
。'
- testString: 'assert.sameMembers(diffArray(["andesite", "grass", "dirt", "dead shrub"], ["andesite", "grass", "dirt", "dead shrub"]), [], "["andesite", "grass", "dirt", "dead shrub"], ["andesite", "grass", "dirt", "dead shrub"]
should return []
.");'
+ testString: assert.sameMembers(diffArray(["andesite", "grass", "dirt", "dead shrub"], ["andesite", "grass", "dirt", "dead shrub"]), []);
- text: '["andesite", "grass", "dirt", "dead shrub"], ["andesite", "grass", "dirt", "dead shrub"]
应返回一个空数组。'
- testString: 'assert(diffArray(["andesite", "grass", "dirt", "dead shrub"], ["andesite", "grass", "dirt", "dead shrub"]).length === 0, "["andesite", "grass", "dirt", "dead shrub"], ["andesite", "grass", "dirt", "dead shrub"]
should return an empty array.");'
+ testString: assert(diffArray(["andesite", "grass", "dirt", "dead shrub"], ["andesite", "grass", "dirt", "dead shrub"]).length === 0);
- text: '[1, 2, 3, 5], [1, 2, 3, 4, 5]
应该返回[4]
。'
- testString: 'assert.sameMembers(diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]), [4], "[1, 2, 3, 5], [1, 2, 3, 4, 5]
should return [4]
.");'
+ testString: assert.sameMembers(diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]), [4]);
- text: '[1, 2, 3, 5], [1, 2, 3, 4, 5]
应该返回一个带有一个项目的数组。'
- testString: 'assert(diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]).length === 1, "[1, 2, 3, 5], [1, 2, 3, 4, 5]
should return an array with one item.");'
+ testString: assert(diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]).length === 1);
- text: '[1, "calf", 3, "piglet"], [1, "calf", 3, 4]
应返回["piglet", 4]
。'
- testString: 'assert.sameMembers(diffArray([1, "calf", 3, "piglet"], [1, "calf", 3, 4]), ["piglet", 4], "[1, "calf", 3, "piglet"], [1, "calf", 3, 4]
should return ["piglet", 4]
.");'
+ testString: assert.sameMembers(diffArray([1, "calf", 3, "piglet"], [1, "calf", 3, 4]), ["piglet", 4]);
- text: '[1, "calf", 3, "piglet"], [1, "calf", 3, 4]
应该返回一个包含两个项目的数组。'
- testString: 'assert(diffArray([1, "calf", 3, "piglet"], [1, "calf", 3, 4]).length === 2, "[1, "calf", 3, "piglet"], [1, "calf", 3, 4]
should return an array with two items.");'
+ testString: assert(diffArray([1, "calf", 3, "piglet"], [1, "calf", 3, 4]).length === 2);
- text: '[], ["snuffleupagus", "cookie monster", "elmo"]
应该返回["snuffleupagus", "cookie monster", "elmo"]
。'
- testString: 'assert.sameMembers(diffArray([], ["snuffleupagus", "cookie monster", "elmo"]), ["snuffleupagus", "cookie monster", "elmo"], "[], ["snuffleupagus", "cookie monster", "elmo"]
should return ["snuffleupagus", "cookie monster", "elmo"]
.");'
+ testString: assert.sameMembers(diffArray([], ["snuffleupagus", "cookie monster", "elmo"]), ["snuffleupagus", "cookie monster", "elmo"]);
- text: '[], ["snuffleupagus", "cookie monster", "elmo"]
应该返回一个包含三个项目的数组。'
- testString: 'assert(diffArray([], ["snuffleupagus", "cookie monster", "elmo"]).length === 3, "[], ["snuffleupagus", "cookie monster", "elmo"]
should return an array with three items.");'
+ testString: assert(diffArray([], ["snuffleupagus", "cookie monster", "elmo"]).length === 3);
- text: '[1, "calf", 3, "piglet"], [7, "filly"]
[1, "calf", 3, "piglet", 7, "filly"]
[1, "calf", 3, "piglet"], [7, "filly"]
应该返回[1, "calf", 3, "piglet", 7, "filly"]
。'
- testString: 'assert.sameMembers(diffArray([1, "calf", 3, "piglet"], [7, "filly"]), [1, "calf", 3, "piglet", 7, "filly"], "[1, "calf", 3, "piglet"], [7, "filly"]
should return [1, "calf", 3, "piglet", 7, "filly"]
.");'
+ testString: assert.sameMembers(diffArray([1, "calf", 3, "piglet"], [7, "filly"]), [1, "calf", 3, "piglet", 7, "filly"]);
- text: '[1, "calf", 3, "piglet"], [7, "filly"]
应该返回一个包含六个项目的数组。'
- testString: 'assert(diffArray([1, "calf", 3, "piglet"], [7, "filly"]).length === 6, "[1, "calf", 3, "piglet"], [7, "filly"]
should return an array with six items.");'
+ testString: assert(diffArray([1, "calf", 3, "piglet"], [7, "filly"]).length === 6);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/dna-pairing.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/dna-pairing.chinese.md
index 25e9029ea8..43359a4ae3 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/dna-pairing.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/dna-pairing.chinese.md
@@ -20,11 +20,11 @@ localeTitle: DNA配对
```yml
tests:
- text: 'pairElement("ATCGA")
应返回[["A","T"],["T","A"],["C","G"],["G","C"],["A","T"]]
。'
- testString: 'assert.deepEqual(pairElement("ATCGA"),[["A","T"],["T","A"],["C","G"],["G","C"],["A","T"]], "pairElement("ATCGA")
should return [["A","T"],["T","A"],["C","G"],["G","C"],["A","T"]]
.");'
+ testString: assert.deepEqual(pairElement("ATCGA"),[["A","T"],["T","A"],["C","G"],["G","C"],["A","T"]]);
- text: 'pairElement("TTGAG")
应返回[["T","A"],["T","A"],["G","C"],["A","T"],["G","C"]]
。'
- testString: 'assert.deepEqual(pairElement("TTGAG"),[["T","A"],["T","A"],["G","C"],["A","T"],["G","C"]], "pairElement("TTGAG")
should return [["T","A"],["T","A"],["G","C"],["A","T"],["G","C"]]
.");'
+ testString: assert.deepEqual(pairElement("TTGAG"),[["T","A"],["T","A"],["G","C"],["A","T"],["G","C"]]);
- text: 'pairElement("CTCTA")
应返回[["C","G"],["T","A"],["C","G"],["T","A"],["A","T"]]
。'
- testString: 'assert.deepEqual(pairElement("CTCTA"),[["C","G"],["T","A"],["C","G"],["T","A"],["A","T"]], "pairElement("CTCTA")
should return [["C","G"],["T","A"],["C","G"],["T","A"],["A","T"]]
.");'
+ testString: assert.deepEqual(pairElement("CTCTA"),[["C","G"],["T","A"],["C","G"],["T","A"],["A","T"]]);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/drop-it.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/drop-it.chinese.md
index f21805ca5e..389cc847a8 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/drop-it.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/drop-it.chinese.md
@@ -20,17 +20,17 @@ localeTitle: 算了吧
```yml
tests:
- text: 'dropElements([1, 2, 3, 4], function(n) {return n >= 3;})
应该返回[3, 4]
。'
- testString: 'assert.deepEqual(dropElements([1, 2, 3, 4], function(n) {return n >= 3;}), [3, 4], "dropElements([1, 2, 3, 4], function(n) {return n >= 3;})
should return [3, 4]
.");'
+ testString: assert.deepEqual(dropElements([1, 2, 3, 4], function(n) {return n >= 3;}), [3, 4]);
- text: 'dropElements([0, 1, 0, 1], function(n) {return n === 1;})
应该返回[1, 0, 1]
dropElements([0, 1, 0, 1], function(n) {return n === 1;})
[1, 0, 1]
。'
- testString: 'assert.deepEqual(dropElements([0, 1, 0, 1], function(n) {return n === 1;}), [1, 0, 1], "dropElements([0, 1, 0, 1], function(n) {return n === 1;})
should return [1, 0, 1]
.");'
+ testString: assert.deepEqual(dropElements([0, 1, 0, 1], function(n) {return n === 1;}), [1, 0, 1]);
- text: 'dropElements([1, 2, 3], function(n) {return n > 0;})
应该返回[1, 2, 3]
。'
- testString: 'assert.deepEqual(dropElements([1, 2, 3], function(n) {return n > 0;}), [1, 2, 3], "dropElements([1, 2, 3], function(n) {return n > 0;})
should return [1, 2, 3]
.");'
+ testString: assert.deepEqual(dropElements([1, 2, 3], function(n) {return n > 0;}), [1, 2, 3]);
- text: 'dropElements([1, 2, 3, 4], function(n) {return n > 5;})
应返回[]
。'
- testString: 'assert.deepEqual(dropElements([1, 2, 3, 4], function(n) {return n > 5;}), [], "dropElements([1, 2, 3, 4], function(n) {return n > 5;})
should return []
.");'
+ testString: assert.deepEqual(dropElements([1, 2, 3, 4], function(n) {return n > 5;}), []);
- text: 'dropElements([1, 2, 3, 7, 4], function(n) {return n > 3;})
应该返回[7, 4]
dropElements([1, 2, 3, 7, 4], function(n) {return n > 3;})
[7, 4]
。'
- testString: 'assert.deepEqual(dropElements([1, 2, 3, 7, 4], function(n) {return n > 3;}), [7, 4], "dropElements([1, 2, 3, 7, 4], function(n) {return n > 3;})
should return [7, 4]
.");'
+ testString: assert.deepEqual(dropElements([1, 2, 3, 7, 4], function(n) {return n > 3;}), [7, 4]);
- text: 'dropElements([1, 2, 3, 9, 2], function(n) {return n > 2;})
应该返回[3, 9, 2]
dropElements([1, 2, 3, 9, 2], function(n) {return n > 2;})
[3, 9, 2]
。'
- testString: 'assert.deepEqual(dropElements([1, 2, 3, 9, 2], function(n) {return n > 2;}), [3, 9, 2], "dropElements([1, 2, 3, 9, 2], function(n) {return n > 2;})
should return [3, 9, 2]
.");'
+ testString: assert.deepEqual(dropElements([1, 2, 3, 9, 2], function(n) {return n > 2;}), [3, 9, 2]);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/everything-be-true.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/everything-be-true.chinese.md
index d5f4fc869a..8632008e15 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/everything-be-true.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/everything-be-true.chinese.md
@@ -20,23 +20,23 @@ localeTitle: 一切都是真的
```yml
tests:
- text: 'truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex")
应该返回true。'
- testString: 'assert.strictEqual(truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex"), true, "truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex")
should return true.");'
+ testString: 'assert.strictEqual(truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex"), true);'
- text: 'truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex")
应该返回false。'
- testString: 'assert.strictEqual(truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex"), false, "truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex")
should return false.");'
+ testString: 'assert.strictEqual(truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex"), false);'
- text: 'truthCheck([{"user": "Tinky-Winky", "sex": "male", "age": 0}, {"user": "Dipsy", "sex": "male", "age": 3}, {"user": "Laa-Laa", "sex": "female", "age": 5}, {"user": "Po", "sex": "female", "age": 4}], "age")
应该返回false。'
- testString: 'assert.strictEqual(truthCheck([{"user": "Tinky-Winky", "sex": "male", "age": 2}, {"user": "Dipsy", "sex": "male", "age": 0}, {"user": "Laa-Laa", "sex": "female", "age": 5}, {"user": "Po", "sex": "female", "age": 4}], "age"), false, "truthCheck([{"user": "Tinky-Winky", "sex": "male", "age": 0}, {"user": "Dipsy", "sex": "male", "age": 3}, {"user": "Laa-Laa", "sex": "female", "age": 5}, {"user": "Po", "sex": "female", "age": 4}], "age")
should return false.");'
+ testString: 'assert.strictEqual(truthCheck([{"user": "Tinky-Winky", "sex": "male", "age": 2}, {"user": "Dipsy", "sex": "male", "age": 0}, {"user": "Laa-Laa", "sex": "female", "age": 5}, {"user": "Po", "sex": "female", "age": 4}], "age"), false);'
- text: 'truthCheck([{"name": "Pete", "onBoat": true}, {"name": "Repeat", "onBoat": true}, {"name": "FastFoward", "onBoat": null}], "onBoat")
应该返回false'
- testString: 'assert.strictEqual(truthCheck([{"name": "Pete", "onBoat": true}, {"name": "Repeat", "onBoat": true}, {"name": "FastFoward", "onBoat": null}], "onBoat"), false, "truthCheck([{"name": "Pete", "onBoat": true}, {"name": "Repeat", "onBoat": true}, {"name": "FastFoward", "onBoat": null}], "onBoat")
should return false");'
+ testString: 'assert.strictEqual(truthCheck([{"name": "Pete", "onBoat": true}, {"name": "Repeat", "onBoat": true}, {"name": "FastForward", "onBoat": null}], "onBoat"), false);'
- text: 'truthCheck([{"name": "Pete", "onBoat": true}, {"name": "Repeat", "onBoat": true, "alias": "Repete"}, {"name": "FastFoward", "onBoat": true}], "onBoat")
应该返回true'
- testString: 'assert.strictEqual(truthCheck([{"name": "Pete", "onBoat": true}, {"name": "Repeat", "onBoat": true, "alias": "Repete"}, {"name": "FastFoward", "onBoat": true}], "onBoat"), true, "truthCheck([{"name": "Pete", "onBoat": true}, {"name": "Repeat", "onBoat": true, "alias": "Repete"}, {"name": "FastFoward", "onBoat": true}], "onBoat")
should return true");'
+ testString: 'assert.strictEqual(truthCheck([{"name": "Pete", "onBoat": true}, {"name": "Repeat", "onBoat": true, "alias": "Repete"}, {"name": "FastForward", "onBoat": true}], "onBoat"), true);'
- text: 'truthCheck([{"single": "yes"}], "single")
应该返回true'
- testString: 'assert.strictEqual(truthCheck([{"single": "yes"}], "single"), true, "truthCheck([{"single": "yes"}], "single")
should return true");'
+ testString: 'assert.strictEqual(truthCheck([{"single": "yes"}], "single"), true);'
- text: 'truthCheck([{"single": ""}, {"single": "double"}], "single")
应该返回false'
- testString: 'assert.strictEqual(truthCheck([{"single": ""}, {"single": "double"}], "single"), false, "truthCheck([{"single": ""}, {"single": "double"}], "single")
should return false");'
+ testString: 'assert.strictEqual(truthCheck([{"single": ""}, {"single": "double"}], "single"), false);'
- text: 'truthCheck([{"single": "double"}, {"single": undefined}], "single")
应返回false'
- testString: 'assert.strictEqual(truthCheck([{"single": "double"}, {"single": undefined}], "single"), false, "truthCheck([{"single": "double"}, {"single": undefined}], "single")
should return false");'
+ testString: 'assert.strictEqual(truthCheck([{"single": "double"}, {"single": undefined}], "single"), false);'
- text: 'truthCheck([{"single": "double"}, {"single": NaN}], "single")
应返回false'
- testString: 'assert.strictEqual(truthCheck([{"single": "double"}, {"single": NaN}], "single"), false, "truthCheck([{"single": "double"}, {"single": NaN}], "single")
should return false");'
+ testString: 'assert.strictEqual(truthCheck([{"single": "double"}, {"single": NaN}], "single"), false);'
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person.chinese.md
index d47fef5614..a8bb0a7628 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person.chinese.md
@@ -19,29 +19,29 @@ localeTitle: 做一个人
```yml
tests:
- text: Object.keys(bob).length
应该返回6。
- testString: 'assert.deepEqual(Object.keys(bob).length, 6, "Object.keys(bob).length
should return 6.");'
+ testString: assert.deepEqual(Object.keys(bob).length, 6);
- text: bob instanceof Person
应该返回true。
- testString: 'assert.deepEqual(bob instanceof Person, true, "bob instanceof Person
should return true.");'
+ testString: assert.deepEqual(bob instanceof Person, true);
- text: bob.firstName
应返回undefined。
- testString: 'assert.deepEqual(bob.firstName, undefined, "bob.firstName
should return undefined.");'
+ testString: assert.deepEqual(bob.firstName, undefined);
- text: bob.lastName
应返回undefined。
- testString: 'assert.deepEqual(bob.lastName, undefined, "bob.lastName
should return undefined.");'
+ testString: assert.deepEqual(bob.lastName, undefined);
- text: bob.getFirstName()
应返回“Bob”。
- testString: 'assert.deepEqual(bob.getFirstName(), "Bob", "bob.getFirstName()
should return "Bob".");'
+ testString: assert.deepEqual(bob.getFirstName(), 'Bob');
- text: bob.getLastName()
应返回“Ross”。
- testString: 'assert.deepEqual(bob.getLastName(), "Ross", "bob.getLastName()
should return "Ross".");'
+ testString: assert.deepEqual(bob.getLastName(), 'Ross');
- text: bob.getFullName()
应该返回“Bob Ross”。
- testString: 'assert.deepEqual(bob.getFullName(), "Bob Ross", "bob.getFullName()
should return "Bob Ross".");'
+ testString: assert.deepEqual(bob.getFullName(), 'Bob Ross');
- text: bob.getFullName()
应该在bob.setFirstName("Haskell")
之后返回“Haskell Ross”。
- testString: 'assert.strictEqual((function () { bob.setFirstName("Haskell"); return bob.getFullName(); })(), "Haskell Ross", "bob.getFullName()
should return "Haskell Ross" after bob.setFirstName("Haskell")
.");'
+ testString: assert.strictEqual((function () { bob.setFirstName("Haskell"); return bob.getFullName(); })(), 'Haskell Ross');
- text: bob.getFullName()
应该在bob.setLastName("Curry")
之后返回“Haskell Curry”。
- testString: 'assert.strictEqual((function () { var _bob=new Person("Haskell Ross"); _bob.setLastName("Curry"); return _bob.getFullName(); })(), "Haskell Curry", "bob.getFullName()
should return "Haskell Curry" after bob.setLastName("Curry")
.");'
+ testString: assert.strictEqual((function () { var _bob=new Person('Haskell Ross'); _bob.setLastName("Curry"); return _bob.getFullName(); })(), 'Haskell Curry');
- text: bob.getFullName()
应该在bob.setFullName("Haskell Curry")
之后返回“Haskell Curry”。
- testString: 'assert.strictEqual((function () { bob.setFullName("Haskell Curry"); return bob.getFullName(); })(), "Haskell Curry", "bob.getFullName()
should return "Haskell Curry" after bob.setFullName("Haskell Curry")
.");'
+ testString: assert.strictEqual((function () { bob.setFullName("Haskell Curry"); return bob.getFullName(); })(), 'Haskell Curry');
- text: bob.getFirstName()
应该在bob.setFullName("Haskell Curry")
之后返回“Haskell”。
- testString: 'assert.strictEqual((function () { bob.setFullName("Haskell Curry"); return bob.getFirstName(); })(), "Haskell", "bob.getFirstName()
should return "Haskell" after bob.setFullName("Haskell Curry")
.");'
+ testString: assert.strictEqual((function () { bob.setFullName("Haskell Curry"); return bob.getFirstName(); })(), 'Haskell');
- text: bob.getLastName()
应该在bob.setFullName("Haskell Curry")
之后返回“Curry”。
- testString: 'assert.strictEqual((function () { bob.setFullName("Haskell Curry"); return bob.getLastName(); })(), "Curry", "bob.getLastName()
should return "Curry" after bob.setFullName("Haskell Curry")
.");'
+ testString: assert.strictEqual((function () { bob.setFullName("Haskell Curry"); return bob.getLastName(); })(), 'Curry');
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/map-the-debris.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/map-the-debris.chinese.md
index 9a6bc6b73a..8be156e514 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/map-the-debris.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/map-the-debris.chinese.md
@@ -19,9 +19,9 @@ localeTitle: 映射碎片
```yml
tests:
- text: 'orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}])
应返回[{name: "sputnik", orbitalPeriod: 86400}]
。'
- testString: 'assert.deepEqual(orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}]), [{name: "sputnik", orbitalPeriod: 86400}], "orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}])
should return [{name: "sputnik", orbitalPeriod: 86400}]
.");'
+ testString: 'assert.deepEqual(orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}]), [{name: "sputnik", orbitalPeriod: 86400}]);'
- text: 'orbitalPeriod([{name: "iss", avgAlt: 413.6}, {name: "hubble", avgAlt: 556.7}, {name: "moon", avgAlt: 378632.553}])
应返回[{name : "iss", orbitalPeriod: 5557}, {name: "hubble", orbitalPeriod: 5734}, {name: "moon", orbitalPeriod: 2377399}]
。'
- testString: 'assert.deepEqual(orbitalPeriod([{name: "iss", avgAlt: 413.6}, {name: "hubble", avgAlt: 556.7}, {name: "moon", avgAlt: 378632.553}]), [{name : "iss", orbitalPeriod: 5557}, {name: "hubble", orbitalPeriod: 5734}, {name: "moon", orbitalPeriod: 2377399}], "orbitalPeriod([{name: "iss", avgAlt: 413.6}, {name: "hubble", avgAlt: 556.7}, {name: "moon", avgAlt: 378632.553}])
should return [{name : "iss", orbitalPeriod: 5557}, {name: "hubble", orbitalPeriod: 5734}, {name: "moon", orbitalPeriod: 2377399}]
.");'
+ testString: 'assert.deepEqual(orbitalPeriod([{name: "iss", avgAlt: 413.6}, {name: "hubble", avgAlt: 556.7}, {name: "moon", avgAlt: 378632.553}]), [{name : "iss", orbitalPeriod: 5557}, {name: "hubble", orbitalPeriod: 5734}, {name: "moon", orbitalPeriod: 2377399}]);'
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/missing-letters.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/missing-letters.chinese.md
index e7221daf0f..d1f4ec4e75 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/missing-letters.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/missing-letters.chinese.md
@@ -20,15 +20,15 @@ localeTitle: 遗失的信件
```yml
tests:
- text: fearNotLetter("abce")
应返回“d”。
- testString: 'assert.deepEqual(fearNotLetter("abce"), "d", "fearNotLetter("abce")
should return "d".");'
+ testString: assert.deepEqual(fearNotLetter('abce'), 'd');
- text: fearNotLetter("abcdefghjklmno")
应该返回“i”。
- testString: 'assert.deepEqual(fearNotLetter("abcdefghjklmno"), "i", "fearNotLetter("abcdefghjklmno")
should return "i".");'
+ testString: assert.deepEqual(fearNotLetter('abcdefghjklmno'), 'i');
- text: fearNotLetter("stvwx")
应该返回“u”。
- testString: 'assert.deepEqual(fearNotLetter("stvwx"), "u", "fearNotLetter("stvwx")
should return "u".");'
+ testString: assert.deepEqual(fearNotLetter('stvwx'), 'u');
- text: fearNotLetter("bcdf")
应返回“e”。
- testString: 'assert.deepEqual(fearNotLetter("bcdf"), "e", "fearNotLetter("bcdf")
should return "e".");'
+ testString: assert.deepEqual(fearNotLetter('bcdf'), 'e');
- text: fearNotLetter("abcdefghijklmnopqrstuvwxyz")
应返回undefined。
- testString: 'assert.isUndefined(fearNotLetter("abcdefghijklmnopqrstuvwxyz"), "fearNotLetter("abcdefghijklmnopqrstuvwxyz")
should return undefined.");'
+ testString: assert.isUndefined(fearNotLetter('abcdefghijklmnopqrstuvwxyz'));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/pig-latin.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/pig-latin.chinese.md
index 8965e1cfd1..b03d743542 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/pig-latin.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/pig-latin.chinese.md
@@ -20,19 +20,19 @@ localeTitle: 猪拉丁文
```yml
tests:
- text: translatePigLatin("california")
应该返回“aliforniacay”。
- testString: 'assert.deepEqual(translatePigLatin("california"), "aliforniacay", "translatePigLatin("california")
should return "aliforniacay".");'
+ testString: assert.deepEqual(translatePigLatin("california"), "aliforniacay");
- text: translatePigLatin("paragraphs")
应该返回“aragraphspay”。
- testString: 'assert.deepEqual(translatePigLatin("paragraphs"), "aragraphspay", "translatePigLatin("paragraphs")
should return "aragraphspay".");'
+ testString: assert.deepEqual(translatePigLatin("paragraphs"), "aragraphspay");
- text: translatePigLatin("glove")
应该返回“oveglay”。
- testString: 'assert.deepEqual(translatePigLatin("glove"), "oveglay", "translatePigLatin("glove")
should return "oveglay".");'
+ testString: assert.deepEqual(translatePigLatin("glove"), "oveglay");
- text: translatePigLatin("algorithm")
应返回“algorithmway”。
- testString: 'assert.deepEqual(translatePigLatin("algorithm"), "algorithmway", "translatePigLatin("algorithm")
should return "algorithmway".");'
+ testString: assert.deepEqual(translatePigLatin("algorithm"), "algorithmway");
- text: translatePigLatin("eight")
应该返回“八通”。
- testString: 'assert.deepEqual(translatePigLatin("eight"), "eightway", "translatePigLatin("eight")
should return "eightway".");'
+ testString: assert.deepEqual(translatePigLatin("eight"), "eightway");
- text: 应该处理第一个元音出现在单词末尾的单词。
- testString: 'assert.deepEqual(translatePigLatin("schwartz"), "artzschway", "Should handle words where the first vowel comes in the end of the word.");'
+ testString: assert.deepEqual(translatePigLatin("schwartz"), "artzschway");
- text: 应该处理没有元音的单词。
- testString: 'assert.deepEqual(translatePigLatin("rhythm"), "rhythmay", "Should handle words without vowels.");'
+ testString: assert.deepEqual(translatePigLatin("rhythm"), "rhythmay");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/search-and-replace.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/search-and-replace.chinese.md
index 403dc3e886..7b2cf9b18f 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/search-and-replace.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/search-and-replace.chinese.md
@@ -20,15 +20,15 @@ localeTitle: 搜索和替换
```yml
tests:
- text: 'myReplace("Let us go to the store", "store", "mall")
应该返回“让我们去商场”。'
- testString: 'assert.deepEqual(myReplace("Let us go to the store", "store", "mall"), "Let us go to the mall", "myReplace("Let us go to the store", "store", "mall")
should return "Let us go to the mall".");'
+ testString: assert.deepEqual(myReplace("Let us go to the store", "store", "mall"), "Let us go to the mall");
- text: 'myReplace("He is Sleeping on the couch", "Sleeping", "sitting")
应该回归“他正坐在沙发上”。'
- testString: 'assert.deepEqual(myReplace("He is Sleeping on the couch", "Sleeping", "sitting"), "He is Sitting on the couch", "myReplace("He is Sleeping on the couch", "Sleeping", "sitting")
should return "He is Sitting on the couch".");'
+ testString: assert.deepEqual(myReplace("He is Sleeping on the couch", "Sleeping", "sitting"), "He is Sitting on the couch");
- text: 'myReplace("This has a spellngi error", "spellngi", "spelling")
应该返回“这有一个拼写错误”。'
- testString: 'assert.deepEqual(myReplace("This has a spellngi error", "spellngi", "spelling"), "This has a spelling error", "myReplace("This has a spellngi error", "spellngi", "spelling")
should return "This has a spelling error".");'
+ testString: assert.deepEqual(myReplace("This has a spellngi error", "spellngi", "spelling"), "This has a spelling error");
- text: 'myReplace("His name is Tom", "Tom", "john")
应该回归“他的名字是约翰”。'
- testString: 'assert.deepEqual(myReplace("His name is Tom", "Tom", "john"), "His name is John", "myReplace("His name is Tom", "Tom", "john")
should return "His name is John".");'
+ testString: assert.deepEqual(myReplace("His name is Tom", "Tom", "john"), "His name is John");
- text: 'myReplace("Let us get back to more Coding", "Coding", "algorithms")
应该返回“让我们回到更多算法”。'
- testString: 'assert.deepEqual(myReplace("Let us get back to more Coding", "Coding", "algorithms"), "Let us get back to more Algorithms", "myReplace("Let us get back to more Coding", "Coding", "algorithms")
should return "Let us get back to more Algorithms".");'
+ testString: assert.deepEqual(myReplace("Let us get back to more Coding", "Coding", "algorithms"), "Let us get back to more Algorithms");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/seek-and-destroy.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/seek-and-destroy.chinese.md
index a27c8fa4a5..4b47ae2c6a 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/seek-and-destroy.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/seek-and-destroy.chinese.md
@@ -20,17 +20,17 @@ localeTitle: 寻找和摧毁
```yml
tests:
- text: 'destroyer([1, 2, 3, 1, 2, 3], 2, 3)
应该返回[1, 1]
。'
- testString: 'assert.deepEqual(destroyer([1, 2, 3, 1, 2, 3], 2, 3), [1, 1], "destroyer([1, 2, 3, 1, 2, 3], 2, 3)
should return [1, 1]
.");'
+ testString: assert.deepEqual(destroyer([1, 2, 3, 1, 2, 3], 2, 3), [1, 1]);
- text: 'destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3)
应该返回[1, 5, 1]
。'
- testString: 'assert.deepEqual(destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3), [1, 5, 1], "destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3)
should return [1, 5, 1]
.");'
+ testString: assert.deepEqual(destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3), [1, 5, 1]);
- text: 'destroyer([3, 5, 1, 2, 2], 2, 3, 5)
应该返回[1]
。'
- testString: 'assert.deepEqual(destroyer([3, 5, 1, 2, 2], 2, 3, 5), [1], "destroyer([3, 5, 1, 2, 2], 2, 3, 5)
should return [1]
.");'
+ testString: assert.deepEqual(destroyer([3, 5, 1, 2, 2], 2, 3, 5), [1]);
- text: 'destroyer([2, 3, 2, 3], 2, 3)
应该返回[]
。'
- testString: 'assert.deepEqual(destroyer([2, 3, 2, 3], 2, 3), [], "destroyer([2, 3, 2, 3], 2, 3)
should return []
.");'
+ testString: assert.deepEqual(destroyer([2, 3, 2, 3], 2, 3), []);
- text: 'destroyer(["tree", "hamburger", 53], "tree", 53)
应该返回["hamburger"]
。'
- testString: 'assert.deepEqual(destroyer(["tree", "hamburger", 53], "tree", 53), ["hamburger"], "destroyer(["tree", "hamburger", 53], "tree", 53)
should return ["hamburger"]
.");'
+ testString: assert.deepEqual(destroyer(["tree", "hamburger", 53], "tree", 53), ["hamburger"]);
- text: 'destroyer(["possum", "trollo", 12, "safari", "hotdog", 92, 65, "grandma", "bugati", "trojan", "yacht"], "yacht", "possum", "trollo", "safari", "hotdog", "grandma", "bugati", "trojan")
应该返回[12,92,65]
。'
- testString: 'assert.deepEqual(destroyer(["possum", "trollo", 12, "safari", "hotdog", 92, 65, "grandma", "bugati", "trojan", "yacht"], "yacht", "possum", "trollo", "safari", "hotdog", "grandma", "bugati", "trojan"), [12,92,65], "destroyer(["possum", "trollo", 12, "safari", "hotdog", 92, 65, "grandma", "bugati", "trojan", "yacht"], "yacht", "possum", "trollo", "safari", "hotdog", "grandma", "bugati", "trojan")
should return [12,92,65]
.");'
+ testString: assert.deepEqual(destroyer(["possum", "trollo", 12, "safari", "hotdog", 92, 65, "grandma", "bugati", "trojan", "yacht"], "yacht", "possum", "trollo", "safari", "hotdog", "grandma", "bugati", "trojan"), [12,92,65]);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/smallest-common-multiple.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/smallest-common-multiple.chinese.md
index dddde1e5c9..01f814501c 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/smallest-common-multiple.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/smallest-common-multiple.chinese.md
@@ -20,17 +20,17 @@ localeTitle: 最小的共同多重
```yml
tests:
- text: 'smallestCommons([1, 5])
应返回一个数字。'
- testString: 'assert.deepEqual(typeof smallestCommons([1, 5]), "number", "smallestCommons([1, 5])
should return a number.");'
+ testString: assert.deepEqual(typeof smallestCommons([1, 5]), 'number');
- text: 'smallestCommons([1, 5])
应该返回60。'
- testString: 'assert.deepEqual(smallestCommons([1, 5]), 60, "smallestCommons([1, 5])
should return 60.");'
+ testString: assert.deepEqual(smallestCommons([1, 5]), 60);
- text: 'smallestCommons([5, 1])
应该返回60。'
- testString: 'assert.deepEqual(smallestCommons([5, 1]), 60, "smallestCommons([5, 1])
should return 60.");'
+ testString: assert.deepEqual(smallestCommons([5, 1]), 60);
- text: 'smallestCommons([2, 10])
2,10 smallestCommons([2, 10])
应返回2520。'
- testString: 'assert.deepEqual(smallestCommons([2, 10]), 2520, "smallestCommons([2, 10])
should return 2520.");'
+ testString: assert.deepEqual(smallestCommons([2, 10]), 2520);
- text: 'smallestCommons([1, 13])
1,13 smallestCommons([1, 13])
应返回360360。'
- testString: 'assert.deepEqual(smallestCommons([1, 13]), 360360, "smallestCommons([1, 13])
should return 360360.");'
+ testString: assert.deepEqual(smallestCommons([1, 13]), 360360);
- text: 'smallestCommons([23, 18])
23,18 smallestCommons([23, 18])
应返回6056820。'
- testString: 'assert.deepEqual(smallestCommons([23, 18]), 6056820, "smallestCommons([23, 18])
should return 6056820.");'
+ testString: assert.deepEqual(smallestCommons([23, 18]), 6056820);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sorted-union.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sorted-union.chinese.md
index c2385ce638..7b510b2bba 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sorted-union.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sorted-union.chinese.md
@@ -20,11 +20,11 @@ localeTitle: 排序联盟
```yml
tests:
- text: 'uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1])
应该返回[1, 3, 2, 5, 4]
uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1])
[1, 3, 2, 5, 4]
。'
- testString: 'assert.deepEqual(uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]), [1, 3, 2, 5, 4], "uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1])
should return [1, 3, 2, 5, 4]
.");'
+ testString: assert.deepEqual(uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]), [1, 3, 2, 5, 4]);
- text: 'uniteUnique([1, 2, 3], [5, 2, 1])
应该返回[1, 2, 3, 5]
uniteUnique([1, 2, 3], [5, 2, 1])
[1, 2, 3, 5]
。'
- testString: 'assert.deepEqual(uniteUnique([1, 2, 3], [5, 2, 1]), [1, 2, 3, 5], "uniteUnique([1, 2, 3], [5, 2, 1])
should return [1, 2, 3, 5]
.");'
+ testString: assert.deepEqual(uniteUnique([1, 2, 3], [5, 2, 1]), [1, 2, 3, 5]);
- text: 'uniteUnique([1, 2, 3], [5, 2, 1, 4], [2, 1], [6, 7, 8])
应该返回[1, 2, 3, 5, 4, 6, 7, 8]
uniteUnique([1, 2, 3], [5, 2, 1, 4], [2, 1], [6, 7, 8])
[1, 2, 3, 5, 4, 6, 7, 8]
。'
- testString: 'assert.deepEqual(uniteUnique([1, 2, 3], [5, 2, 1, 4], [2, 1], [6, 7, 8]), [1, 2, 3, 5, 4, 6, 7, 8], "uniteUnique([1, 2, 3], [5, 2, 1, 4], [2, 1], [6, 7, 8])
should return [1, 2, 3, 5, 4, 6, 7, 8]
.");'
+ testString: assert.deepEqual(uniteUnique([1, 2, 3], [5, 2, 1, 4], [2, 1], [6, 7, 8]), [1, 2, 3, 5, 4, 6, 7, 8]);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/spinal-tap-case.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/spinal-tap-case.chinese.md
index 496db79348..d9a107d847 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/spinal-tap-case.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/spinal-tap-case.chinese.md
@@ -20,15 +20,15 @@ localeTitle: 脊椎龙头套
```yml
tests:
- text: spinalCase("This Is Spinal Tap")
应该返回"this-is-spinal-tap"
。
- testString: 'assert.deepEqual(spinalCase("This Is Spinal Tap"), "this-is-spinal-tap", "spinalCase("This Is Spinal Tap")
should return "this-is-spinal-tap"
.");'
+ testString: assert.deepEqual(spinalCase("This Is Spinal Tap"), "this-is-spinal-tap");
- text: spinalCase("thisIsSpinal Tap")
应该返回"this-is-spinal-tap"
。
- testString: 'assert.strictEqual(spinalCase("thisIsSpinalTap"), "this-is-spinal-tap", "spinalCase("thisIsSpinal
should return "this-is-spinal-tap"
.");'
+ testString: assert.strictEqual(spinalCase('thisIsSpinalTap'), "this-is-spinal-tap");
- text: spinalCase("The_Andy_ Griffith_Show")
应该返回"the-andy-griffith-show"
。
- testString: 'assert.strictEqual(spinalCase("The_Andy_Griffith_Show"), "the-andy-griffith-show", "spinalCase("The_Andy_
should return "the-andy-griffith-show"
.");'
+ testString: assert.strictEqual(spinalCase("The_Andy_Griffith_Show"), "the-andy-griffith-show");
- text: spinalCase("Teletubbies say Eh-oh")
应该返回"teletubbies-say-eh-oh"
。
- testString: 'assert.strictEqual(spinalCase("Teletubbies say Eh-oh"), "teletubbies-say-eh-oh", "spinalCase("Teletubbies say Eh-oh")
should return "teletubbies-say-eh-oh"
.");'
+ testString: assert.strictEqual(spinalCase("Teletubbies say Eh-oh"), "teletubbies-say-eh-oh");
- text: spinalCase("AllThe-small Things")
应该归还"all-the-small-things"
。
- testString: 'assert.strictEqual(spinalCase("AllThe-small Things"), "all-the-small-things", "spinalCase("AllThe-small Things")
should return "all-the-small-things"
.");'
+ testString: assert.strictEqual(spinalCase("AllThe-small Things"), "all-the-small-things");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.chinese.md
index f10b4be9c1..10ac64733a 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.chinese.md
@@ -20,13 +20,13 @@ localeTitle: 压路机
```yml
tests:
- text: 'steamrollArray([[["a"]], [["b"]]])
应返回["a", "b"]
。'
- testString: 'assert.deepEqual(steamrollArray([[["a"]], [["b"]]]), ["a", "b"], "steamrollArray([[["a"]], [["b"]]])
should return ["a", "b"]
.");'
+ testString: assert.deepEqual(steamrollArray([[["a"]], [["b"]]]), ["a", "b"]);
- text: 'steamrollArray([1, [2], [3, [[4]]]])
应该返回[1, 2, 3, 4]
。'
- testString: 'assert.deepEqual(steamrollArray([1, [2], [3, [[4]]]]), [1, 2, 3, 4], "steamrollArray([1, [2], [3, [[4]]]])
should return [1, 2, 3, 4]
.");'
+ testString: assert.deepEqual(steamrollArray([1, [2], [3, [[4]]]]), [1, 2, 3, 4]);
- text: 'steamrollArray([1, [], [3, [[4]]]])
应该返回[1, 3, 4]
。'
- testString: 'assert.deepEqual(steamrollArray([1, [], [3, [[4]]]]), [1, 3, 4], "steamrollArray([1, [], [3, [[4]]]])
should return [1, 3, 4]
.");'
+ testString: assert.deepEqual(steamrollArray([1, [], [3, [[4]]]]), [1, 3, 4]);
- text: 'steamrollArray([1, {}, [3, [[4]]]])
应返回[1, {}, 3, 4]
。'
- testString: 'assert.deepEqual(steamrollArray([1, {}, [3, [[4]]]]), [1, {}, 3, 4], "steamrollArray([1, {}, [3, [[4]]]])
should return [1, {}, 3, 4]
.");'
+ testString: assert.deepEqual(steamrollArray([1, {}, [3, [[4]]]]), [1, {}, 3, 4]);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-numbers-in-a-range.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-numbers-in-a-range.chinese.md
index 800e58d972..30052e11f4 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-numbers-in-a-range.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-numbers-in-a-range.chinese.md
@@ -20,15 +20,15 @@ localeTitle: 求和范围中的所有数字
```yml
tests:
- text: 'sumAll([1, 4])
应该返回一个数字。'
- testString: 'assert(typeof sumAll([1, 4]) === "number", "sumAll([1, 4])
should return a number.");'
+ testString: assert(typeof sumAll([1, 4]) === 'number');
- text: 'sumAll([1, 4])
应该返回10。'
- testString: 'assert.deepEqual(sumAll([1, 4]), 10, "sumAll([1, 4])
should return 10.");'
+ testString: assert.deepEqual(sumAll([1, 4]), 10);
- text: 'sumAll([4, 1])
应该返回10。'
- testString: 'assert.deepEqual(sumAll([4, 1]), 10, "sumAll([4, 1])
should return 10.");'
+ testString: assert.deepEqual(sumAll([4, 1]), 10);
- text: 'sumAll([5, 10])
应该返回45。'
- testString: 'assert.deepEqual(sumAll([5, 10]), 45, "sumAll([5, 10])
should return 45.");'
+ testString: assert.deepEqual(sumAll([5, 10]), 45);
- text: 'sumAll([10, 5])
应该返回45。'
- testString: 'assert.deepEqual(sumAll([10, 5]), 45, "sumAll([10, 5])
should return 45.");'
+ testString: assert.deepEqual(sumAll([10, 5]), 45);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-odd-fibonacci-numbers.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-odd-fibonacci-numbers.chinese.md
index 35cd6436df..b7a67a49f8 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-odd-fibonacci-numbers.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-odd-fibonacci-numbers.chinese.md
@@ -20,17 +20,17 @@ localeTitle: 求所有奇数斐波纳契数
```yml
tests:
- text: sumFibs(1)
应该返回一个数字。
- testString: 'assert(typeof sumFibs(1) === "number", "sumFibs(1)
should return a number.");'
+ testString: assert(typeof sumFibs(1) === "number");
- text: sumFibs(1000)
应该返回1785。
- testString: 'assert(sumFibs(1000) === 1785, "sumFibs(1000)
should return 1785.");'
+ testString: assert(sumFibs(1000) === 1785);
- text: sumFibs(4000000)
应返回4613732。
- testString: 'assert(sumFibs(4000000) === 4613732, "sumFibs(4000000)
should return 4613732.");'
+ testString: assert(sumFibs(4000000) === 4613732);
- text: sumFibs(4)
应该返回5。
- testString: 'assert(sumFibs(4) === 5, "sumFibs(4)
should return 5.");'
+ testString: assert(sumFibs(4) === 5);
- text: sumFibs(75024)
应该返回60696。
- testString: 'assert(sumFibs(75024) === 60696, "sumFibs(75024)
should return 60696.");'
+ testString: assert(sumFibs(75024) === 60696);
- text: sumFibs(75025)
应该返回135721。
- testString: 'assert(sumFibs(75025) === 135721, "sumFibs(75025)
should return 135721.");'
+ testString: assert(sumFibs(75025) === 135721);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-primes.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-primes.chinese.md
index 22810c286c..0d19d009d2 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-primes.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-primes.chinese.md
@@ -20,11 +20,11 @@ localeTitle: Sum All Primes
```yml
tests:
- text: sumPrimes(10)
应该返回一个数字。
- testString: 'assert.deepEqual(typeof sumPrimes(10), "number", "sumPrimes(10)
should return a number.");'
+ testString: assert.deepEqual(typeof sumPrimes(10), 'number');
- text: sumPrimes(10)
应该返回17。
- testString: 'assert.deepEqual(sumPrimes(10), 17, "sumPrimes(10)
should return 17.");'
+ testString: assert.deepEqual(sumPrimes(10), 17);
- text: sumPrimes(977)
应该返回73156。
- testString: 'assert.deepEqual(sumPrimes(977), 73156, "sumPrimes(977)
should return 73156.");'
+ testString: assert.deepEqual(sumPrimes(977), 73156);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/wherefore-art-thou.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/wherefore-art-thou.chinese.md
index f2bf667f1e..e9d06f5a81 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/wherefore-art-thou.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/wherefore-art-thou.chinese.md
@@ -20,17 +20,17 @@ localeTitle: 因此,你是艺术家
```yml
tests:
- text: 'whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" })
应该返回[{ first: "Tybalt", last: "Capulet" }]
'
- testString: 'assert.deepEqual(whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" }), [{ first: "Tybalt", last: "Capulet" }], "whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" })
should return [{ first: "Tybalt", last: "Capulet" }]
.");'
+ testString: 'assert.deepEqual(whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" }), [{ first: "Tybalt", last: "Capulet" }]);'
- text: 'whatIsInAName([{ "apple": 1 }, { "apple": 1 }, { "apple": 1, "bat": 2 }], { "apple": 1 })
应返回[{ "apple": 1 }, { "apple": 1 }, { "apple": 1, "bat": 2 }]
。'
- testString: 'assert.deepEqual(whatIsInAName([{ "apple": 1 }, { "apple": 1 }, { "apple": 1, "bat": 2 }], { "apple": 1 }), [{ "apple": 1 }, { "apple": 1 }, { "apple": 1, "bat": 2 }], "whatIsInAName([{ "apple": 1 }, { "apple": 1 }, { "apple": 1, "bat": 2 }], { "apple": 1 })
should return [{ "apple": 1 }, { "apple": 1 }, { "apple": 1, "bat": 2 }]
.");'
+ testString: 'assert.deepEqual(whatIsInAName([{ "apple": 1 }, { "apple": 1 }, { "apple": 1, "bat": 2 }], { "apple": 1 }), [{ "apple": 1 }, { "apple": 1 }, { "apple": 1, "bat": 2 }]);'
- text: 'whatIsInAName([{ "apple": 1, "bat": 2 }, { "bat": 2 }, { "apple": 1, "bat": 2, "cookie": 2 }], { "apple": 1, "bat": 2 })
应该返回[{ "apple": 1, "bat": 2 }, { "apple": 1, "bat": 2, "cookie": 2 }]
。'
- testString: 'assert.deepEqual(whatIsInAName([{ "apple": 1, "bat": 2 }, { "bat": 2 }, { "apple": 1, "bat": 2, "cookie": 2 }], { "apple": 1, "bat": 2 }), [{ "apple": 1, "bat": 2 }, { "apple": 1, "bat": 2, "cookie": 2 }], "whatIsInAName([{ "apple": 1, "bat": 2 }, { "bat": 2 }, { "apple": 1, "bat": 2, "cookie": 2 }], { "apple": 1, "bat": 2 })
should return [{ "apple": 1, "bat": 2 }, { "apple": 1, "bat": 2, "cookie": 2 }]
.");'
+ testString: 'assert.deepEqual(whatIsInAName([{ "apple": 1, "bat": 2 }, { "bat": 2 }, { "apple": 1, "bat": 2, "cookie": 2 }], { "apple": 1, "bat": 2 }), [{ "apple": 1, "bat": 2 }, { "apple": 1, "bat": 2, "cookie": 2 }]);'
- text: 'whatIsInAName([{ "apple": 1, "bat": 2 }, { "apple": 1 }, { "apple": 1, "bat": 2, "cookie": 2 }], { "apple": 1, "cookie": 2 })
应该返回[{ "apple": 1, "bat": 2, "cookie": 2 }]
。'
- testString: 'assert.deepEqual(whatIsInAName([{ "apple": 1, "bat": 2 }, { "apple": 1 }, { "apple": 1, "bat": 2, "cookie": 2 }], { "apple": 1, "cookie": 2 }), [{ "apple": 1, "bat": 2, "cookie": 2 }], "whatIsInAName([{ "apple": 1, "bat": 2 }, { "apple": 1 }, { "apple": 1, "bat": 2, "cookie": 2 }], { "apple": 1, "cookie": 2 })
should return [{ "apple": 1, "bat": 2, "cookie": 2 }]
.");'
+ testString: 'assert.deepEqual(whatIsInAName([{ "apple": 1, "bat": 2 }, { "apple": 1 }, { "apple": 1, "bat": 2, "cookie": 2 }], { "apple": 1, "cookie": 2 }), [{ "apple": 1, "bat": 2, "cookie": 2 }]);'
- text: 'whatIsInAName([{ "apple": 1, "bat": 2 }, { "apple": 1 }, { "apple": 1, "bat": 2, "cookie": 2 }, { "bat":2 }], { "apple": 1, "bat": 2 })
应该返回[{ "apple": 1, "bat": 2 }, { "apple": 1, "bat": 2, "cookie":2 }]
。'
- testString: 'assert.deepEqual(whatIsInAName([{ "apple": 1, "bat": 2 }, { "apple": 1 }, { "apple": 1, "bat": 2, "cookie": 2 }, {"bat":2}], { "apple": 1, "bat": 2 }), [{ "apple": 1, "bat": 2 }, { "apple": 1, "bat": 2, "cookie":2 }], "whatIsInAName([{ "apple": 1, "bat": 2 }, { "apple": 1 }, { "apple": 1, "bat": 2, "cookie": 2 }, { "bat":2 }], { "apple": 1, "bat": 2 })
should return [{ "apple": 1, "bat": 2 }, { "apple": 1, "bat": 2, "cookie":2 }]
.");'
+ testString: 'assert.deepEqual(whatIsInAName([{ "apple": 1, "bat": 2 }, { "apple": 1 }, { "apple": 1, "bat": 2, "cookie": 2 }, {"bat":2}], { "apple": 1, "bat": 2 }), [{ "apple": 1, "bat": 2 }, { "apple": 1, "bat": 2, "cookie":2 }]);'
- text: 'whatIsInAName([{"a": 1, "b": 2, "c": 3}], {"a": 1, "b": 9999, "c": 3})
应该返回[]
'
- testString: 'assert.deepEqual(whatIsInAName([{ "a": 1, "b": 2, "c": 3 }], { "a": 1, "b": 9999, "c": 3 }), [], "whatIsInAName([{"a": 1, "b": 2, "c": 3}], {"a": 1, "b": 9999, "c": 3})
should return []
");'
+ testString: 'assert.deepEqual(whatIsInAName([{ "a": 1, "b": 2, "c": 3 }], { "a": 1, "b": 9999, "c": 3 }), []);'
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/caesars-cipher.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/caesars-cipher.chinese.md
index 5a85bdc35b..efdf780d70 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/caesars-cipher.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/caesars-cipher.chinese.md
@@ -20,13 +20,13 @@ localeTitle: 凯撒密码
```yml
tests:
- text: rot13("SERR PBQR PNZC")
应解码为FREE CODE CAMP
- testString: 'assert(rot13("SERR PBQR PNZC") === "FREE CODE CAMP", "rot13("SERR PBQR PNZC")
should decode to FREE CODE CAMP
");'
+ testString: assert(rot13("SERR PBQR PNZC") === "FREE CODE CAMP");
- text: rot13("SERR CVMMN!")
应该解码为FREE PIZZA!
rot13("SERR CVMMN!")
FREE PIZZA!
- testString: 'assert(rot13("SERR CVMMN!") === "FREE PIZZA!", "rot13("SERR CVMMN!")
should decode to FREE PIZZA!
");'
+ testString: assert(rot13("SERR CVMMN!") === "FREE PIZZA!");
- text: rot13("SERR YBIR?")
应解码为FREE LOVE?
- testString: 'assert(rot13("SERR YBIR?") === "FREE LOVE?", "rot13("SERR YBIR?")
should decode to FREE LOVE?
");'
+ testString: assert(rot13("SERR YBIR?") === "FREE LOVE?");
- text: rot13("GUR DHVPX OEBJA SBK WHZCF BIRE GUR YNML QBT.")
应该在rot13("GUR DHVPX OEBJA SBK WHZCF BIRE GUR YNML QBT.")
解码到THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.
- testString: 'assert(rot13("GUR DHVPX OEBJA SBK WHZCF BIRE GUR YNML QBT.") === "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.", "rot13("GUR DHVPX OEBJA SBK WHZCF BIRE GUR YNML QBT.")
should decode to THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.
");'
+ testString: assert(rot13("GUR DHVPX OEBJA SBK WHZCF BIRE GUR YNML QBT.") === "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/cash-register.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/cash-register.chinese.md
index 833503ddc1..abecd4986c 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/cash-register.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/cash-register.chinese.md
@@ -20,17 +20,17 @@ localeTitle: 收银机
```yml
tests:
- text: 'checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]])
应该返回一个物体。'
- testString: 'assert.deepEqual(Object.prototype.toString.call(checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]])), "[object Object]", "checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]])
should return an object.");'
+ testString: assert.deepEqual(Object.prototype.toString.call(checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]])), '[object Object]');
- text: 'checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]])
应返回{status: "OPEN", change: [["QUARTER", 0.5]]}
。'
- testString: 'assert.deepEqual(checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]]), {status: "OPEN", change: [["QUARTER", 0.5]]}, "checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]])
should return {status: "OPEN", change: [["QUARTER", 0.5]]}
.");'
+ testString: 'assert.deepEqual(checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]]), {status: "OPEN", change: [["QUARTER", 0.5]]});'
- text: 'checkCashRegister(3.26, 100, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]])
应返回{status: "OPEN", change: [["TWENTY", 60], ["TEN", 20], ["FIVE", 15], ["ONE", 1], ["QUARTER", 0.5], ["DIME", 0.2], ["PENNY", 0.04]]}
。'
- testString: 'assert.deepEqual(checkCashRegister(3.26, 100, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]]), {status: "OPEN", change: [["TWENTY", 60], ["TEN", 20], ["FIVE", 15], ["ONE", 1], ["QUARTER", 0.5], ["DIME", 0.2], ["PENNY", 0.04]]}, "checkCashRegister(3.26, 100, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]])
should return {status: "OPEN", change: [["TWENTY", 60], ["TEN", 20], ["FIVE", 15], ["ONE", 1], ["QUARTER", 0.5], ["DIME", 0.2], ["PENNY", 0.04]]}
.");'
+ testString: 'assert.deepEqual(checkCashRegister(3.26, 100, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]]), {status: "OPEN", change: [["TWENTY", 60], ["TEN", 20], ["FIVE", 15], ["ONE", 1], ["QUARTER", 0.5], ["DIME", 0.2], ["PENNY", 0.04]]});'
- text: 'checkCashRegister(19.5, 20, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]])
应返回{status: "INSUFFICIENT_FUNDS", change: []}
。'
- testString: 'assert.deepEqual(checkCashRegister(19.5, 20, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]), {status: "INSUFFICIENT_FUNDS", change: []}, "checkCashRegister(19.5, 20, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]])
should return {status: "INSUFFICIENT_FUNDS", change: []}
.");'
+ testString: 'assert.deepEqual(checkCashRegister(19.5, 20, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]), {status: "INSUFFICIENT_FUNDS", change: []});'
- text: 'checkCashRegister(19.5, 20, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 1], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]])
应返回{status: "INSUFFICIENT_FUNDS", change: []}
。'
- testString: 'assert.deepEqual(checkCashRegister(19.5, 20, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 1], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]), {status: "INSUFFICIENT_FUNDS", change: []}, "checkCashRegister(19.5, 20, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 1], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]])
should return {status: "INSUFFICIENT_FUNDS", change: []}
.");'
+ testString: 'assert.deepEqual(checkCashRegister(19.5, 20, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 1], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]), {status: "INSUFFICIENT_FUNDS", change: []});'
- text: 'checkCashRegister(19.5, 20, [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]])
应返回{status: "CLOSED", change: [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]}
。'
- testString: 'assert.deepEqual(checkCashRegister(19.5, 20, [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]), {status: "CLOSED", change: [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]}, "checkCashRegister(19.5, 20, [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]])
should return {status: "CLOSED", change: [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]}
.");'
+ testString: 'assert.deepEqual(checkCashRegister(19.5, 20, [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]), {status: "CLOSED", change: [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]});'
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker.chinese.md
index fb1fc4d6c0..c397a9eaef 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/palindrome-checker.chinese.md
@@ -20,31 +20,31 @@ localeTitle: 回文检查
```yml
tests:
- text: palindrome("eye")
应该返回一个布尔值。
- testString: 'assert(typeof palindrome("eye") === "boolean", "palindrome("eye")
should return a boolean.");'
+ testString: assert(typeof palindrome("eye") === "boolean");
- text: palindrome("eye")
应该返回true。
- testString: 'assert(palindrome("eye") === true, "palindrome("eye")
should return true.");'
+ testString: assert(palindrome("eye") === true);
- text: palindrome("_eye")
应该返回true。
- testString: 'assert(palindrome("_eye") === true, "palindrome("_eye")
should return true.");'
+ testString: assert(palindrome("_eye") === true);
- text: palindrome("race car")
应该返回true。
- testString: 'assert(palindrome("race car") === true, "palindrome("race car")
should return true.");'
+ testString: assert(palindrome("race car") === true);
- text: palindrome("not a palindrome")
应该返回false。
- testString: 'assert(palindrome("not a palindrome") === false, "palindrome("not a palindrome")
should return false.");'
+ testString: assert(palindrome("not a palindrome") === false);
- text: 'palindrome("A man, a plan, a canal. Panama")
应该回归真实。'
- testString: 'assert(palindrome("A man, a plan, a canal. Panama") === true, "palindrome("A man, a plan, a canal. Panama")
should return true.");'
+ testString: assert(palindrome("A man, a plan, a canal. Panama") === true);
- text: palindrome("never odd or even")
应该返回true。
- testString: 'assert(palindrome("never odd or even") === true, "palindrome("never odd or even")
should return true.");'
+ testString: assert(palindrome("never odd or even") === true);
- text: palindrome("nope")
应该返回false。
- testString: 'assert(palindrome("nope") === false, "palindrome("nope")
should return false.");'
+ testString: assert(palindrome("nope") === false);
- text: palindrome("almostomla")
应该返回false。
- testString: 'assert(palindrome("almostomla") === false, "palindrome("almostomla")
should return false.");'
+ testString: assert(palindrome("almostomla") === false);
- text: 'palindrome("My age is 0, 0 si ega ym.")
应该返回true。'
- testString: 'assert(palindrome("My age is 0, 0 si ega ym.") === true, "palindrome("My age is 0, 0 si ega ym.")
should return true.");'
+ testString: assert(palindrome("My age is 0, 0 si ega ym.") === true);
- text: palindrome("1 eye for of 1 eye.")
应该返回假。
- testString: 'assert(palindrome("1 eye for of 1 eye.") === false, "palindrome("1 eye for of 1 eye.")
should return false.");'
+ testString: assert(palindrome("1 eye for of 1 eye.") === false);
- text: 'palindrome("0_0 (: /-\ :) 0-0")
应该返回true。'
- testString: 'assert(palindrome("0_0 (: /-\ :) 0-0") === true, "palindrome("0_0 (: /-\ :) 0-0")
should return true.");'
+ testString: 'assert(palindrome("0_0 (: /-\ :) 0-0") === true);'
- text: palindrome("five|\_/|four")
应该返回false。
- testString: 'assert(palindrome("five|\_/|four") === false, "palindrome("five|\_/|four")
should return false.");'
+ testString: assert(palindrome("five|\_/|four") === false);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/roman-numeral-converter.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/roman-numeral-converter.chinese.md
index 8cd8b7b289..8eed8d41ee 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/roman-numeral-converter.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/roman-numeral-converter.chinese.md
@@ -20,57 +20,57 @@ localeTitle: 罗马数字转换器
```yml
tests:
- text: convertToRoman(2)
应该返回“II”。
- testString: 'assert.deepEqual(convertToRoman(2), "II", "convertToRoman(2)
should return "II".");'
+ testString: assert.deepEqual(convertToRoman(2), "II");
- text: convertToRoman(3)
应该返回“III”。
- testString: 'assert.deepEqual(convertToRoman(3), "III", "convertToRoman(3)
should return "III".");'
+ testString: assert.deepEqual(convertToRoman(3), "III");
- text: convertToRoman(4)
应该返回“IV”。
- testString: 'assert.deepEqual(convertToRoman(4), "IV", "convertToRoman(4)
should return "IV".");'
+ testString: assert.deepEqual(convertToRoman(4), "IV");
- text: convertToRoman(5)
应该返回“V”。
- testString: 'assert.deepEqual(convertToRoman(5), "V", "convertToRoman(5)
should return "V".");'
+ testString: assert.deepEqual(convertToRoman(5), "V");
- text: convertToRoman(9)
应该返回“IX”。
- testString: 'assert.deepEqual(convertToRoman(9), "IX", "convertToRoman(9)
should return "IX".");'
+ testString: assert.deepEqual(convertToRoman(9), "IX");
- text: convertToRoman(12)
应返回“XII”。
- testString: 'assert.deepEqual(convertToRoman(12), "XII", "convertToRoman(12)
should return "XII".");'
+ testString: assert.deepEqual(convertToRoman(12), "XII");
- text: convertToRoman(16)
应返回“XVI”。
- testString: 'assert.deepEqual(convertToRoman(16), "XVI", "convertToRoman(16)
should return "XVI".");'
+ testString: assert.deepEqual(convertToRoman(16), "XVI");
- text: convertToRoman(29)
应该返回“XXIX”。
- testString: 'assert.deepEqual(convertToRoman(29), "XXIX", "convertToRoman(29)
should return "XXIX".");'
+ testString: assert.deepEqual(convertToRoman(29), "XXIX");
- text: convertToRoman(44)
应该返回“XLIV”。
- testString: 'assert.deepEqual(convertToRoman(44), "XLIV", "convertToRoman(44)
should return "XLIV".");'
+ testString: assert.deepEqual(convertToRoman(44), "XLIV");
- text: convertToRoman(45)
应该返回“XLV”
- testString: 'assert.deepEqual(convertToRoman(45), "XLV", "convertToRoman(45)
should return "XLV"");'
+ testString: assert.deepEqual(convertToRoman(45), "XLV");
- text: convertToRoman(68)
应返回“LXVIII”
- testString: 'assert.deepEqual(convertToRoman(68), "LXVIII", "convertToRoman(68)
should return "LXVIII"");'
+ testString: assert.deepEqual(convertToRoman(68), "LXVIII");
- text: convertToRoman(83)
应返回“LXXXIII”
- testString: 'assert.deepEqual(convertToRoman(83), "LXXXIII", "convertToRoman(83)
should return "LXXXIII"");'
+ testString: assert.deepEqual(convertToRoman(83), "LXXXIII");
- text: convertToRoman(97)
应该返回“XCVII”
- testString: 'assert.deepEqual(convertToRoman(97), "XCVII", "convertToRoman(97)
should return "XCVII"");'
+ testString: assert.deepEqual(convertToRoman(97), "XCVII");
- text: convertToRoman(99)
应返回“XCIX”
- testString: 'assert.deepEqual(convertToRoman(99), "XCIX", "convertToRoman(99)
should return "XCIX"");'
+ testString: assert.deepEqual(convertToRoman(99), "XCIX");
- text: convertToRoman(400)
应返回“CD”
- testString: 'assert.deepEqual(convertToRoman(400), "CD", "convertToRoman(400)
should return "CD"");'
+ testString: assert.deepEqual(convertToRoman(400), "CD");
- text: convertToRoman(500)
应返回“D”
- testString: 'assert.deepEqual(convertToRoman(500), "D", "convertToRoman(500)
should return "D"");'
+ testString: assert.deepEqual(convertToRoman(500), "D");
- text: convertToRoman(501)
应返回“DI”
- testString: 'assert.deepEqual(convertToRoman(501), "DI", "convertToRoman(501)
should return "DI"");'
+ testString: assert.deepEqual(convertToRoman(501), "DI");
- text: convertToRoman(649)
应返回“DCXLIX”
- testString: 'assert.deepEqual(convertToRoman(649), "DCXLIX", "convertToRoman(649)
should return "DCXLIX"");'
+ testString: assert.deepEqual(convertToRoman(649), "DCXLIX");
- text: convertToRoman(798)
应返回“DCCXCVIII”
- testString: 'assert.deepEqual(convertToRoman(798), "DCCXCVIII", "convertToRoman(798)
should return "DCCXCVIII"");'
+ testString: assert.deepEqual(convertToRoman(798), "DCCXCVIII");
- text: convertToRoman(891)
应返回“DCCCXCI”
- testString: 'assert.deepEqual(convertToRoman(891), "DCCCXCI", "convertToRoman(891)
should return "DCCCXCI"");'
+ testString: assert.deepEqual(convertToRoman(891), "DCCCXCI");
- text: convertToRoman(1000)
应该返回“M”
- testString: 'assert.deepEqual(convertToRoman(1000), "M", "convertToRoman(1000)
should return "M"");'
+ testString: assert.deepEqual(convertToRoman(1000), "M");
- text: convertToRoman(1004)
应返回“MIV”
- testString: 'assert.deepEqual(convertToRoman(1004), "MIV", "convertToRoman(1004)
should return "MIV"");'
+ testString: assert.deepEqual(convertToRoman(1004), "MIV");
- text: convertToRoman(1006)
应返回“MVI”
- testString: 'assert.deepEqual(convertToRoman(1006), "MVI", "convertToRoman(1006)
should return "MVI"");'
+ testString: assert.deepEqual(convertToRoman(1006), "MVI");
- text: convertToRoman(1023)
应返回“MXXIII”
- testString: 'assert.deepEqual(convertToRoman(1023), "MXXIII", "convertToRoman(1023)
should return "MXXIII"");'
+ testString: assert.deepEqual(convertToRoman(1023), "MXXIII");
- text: convertToRoman(2014)
应返回“MMXIV”
- testString: 'assert.deepEqual(convertToRoman(2014), "MMXIV", "convertToRoman(2014)
should return "MMXIV"");'
+ testString: assert.deepEqual(convertToRoman(2014), "MMXIV");
- text: convertToRoman(3999)
应返回“MMMCMXCIX”
- testString: 'assert.deepEqual(convertToRoman(3999), "MMMCMXCIX", "convertToRoman(3999)
should return "MMMCMXCIX"");'
+ testString: assert.deepEqual(convertToRoman(3999), "MMMCMXCIX");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/telephone-number-validator.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/telephone-number-validator.chinese.md
index c6f5152037..dca6bdb639 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/telephone-number-validator.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/telephone-number-validator.chinese.md
@@ -20,59 +20,59 @@ localeTitle: 电话号码验证器
```yml
tests:
- text: telephoneCheck("555-555-5555")
应该返回一个布尔值。
- testString: 'assert(typeof telephoneCheck("555-555-5555") === "boolean", "telephoneCheck("555-555-5555")
should return a boolean.");'
+ testString: assert(typeof telephoneCheck("555-555-5555") === "boolean");
- text: telephoneCheck("1 555-555-5555")
应该返回true。
- testString: 'assert(telephoneCheck("1 555-555-5555") === true, "telephoneCheck("1 555-555-5555")
should return true.");'
+ testString: assert(telephoneCheck("1 555-555-5555") === true);
- text: telephoneCheck("1 (555) 555-5555")
应该返回true。
- testString: 'assert(telephoneCheck("1 (555) 555-5555") === true, "telephoneCheck("1 (555) 555-5555")
should return true.");'
+ testString: assert(telephoneCheck("1 (555) 555-5555") === true);
- text: telephoneCheck("5555555555")
应该返回true。
- testString: 'assert(telephoneCheck("5555555555") === true, "telephoneCheck("5555555555")
should return true.");'
+ testString: assert(telephoneCheck("5555555555") === true);
- text: telephoneCheck("555-555-5555")
应该返回true。
- testString: 'assert(telephoneCheck("555-555-5555") === true, "telephoneCheck("555-555-5555")
should return true.");'
+ testString: assert(telephoneCheck("555-555-5555") === true);
- text: telephoneCheck("(555)555-5555")
应该返回true。
- testString: 'assert(telephoneCheck("(555)555-5555") === true, "telephoneCheck("(555)555-5555")
should return true.");'
+ testString: assert(telephoneCheck("(555)555-5555") === true);
- text: telephoneCheck("1(555)555-5555")
应该返回true。
- testString: 'assert(telephoneCheck("1(555)555-5555") === true, "telephoneCheck("1(555)555-5555")
should return true.");'
+ testString: assert(telephoneCheck("1(555)555-5555") === true);
- text: telephoneCheck("555-5555")
应该返回false。
- testString: 'assert(telephoneCheck("555-5555") === false, "telephoneCheck("555-5555")
should return false.");'
+ testString: assert(telephoneCheck("555-5555") === false);
- text: telephoneCheck("5555555")
应该返回false。
- testString: 'assert(telephoneCheck("5555555") === false, "telephoneCheck("5555555")
should return false.");'
+ testString: assert(telephoneCheck("5555555") === false);
- text: telephoneCheck("1 555)555-5555")
应该返回false。
- testString: 'assert(telephoneCheck("1 555)555-5555") === false, "telephoneCheck("1 555)555-5555")
should return false.");'
+ testString: assert(telephoneCheck("1 555)555-5555") === false);
- text: telephoneCheck("1 555 555 5555")
应该返回true。
- testString: 'assert(telephoneCheck("1 555 555 5555") === true, "telephoneCheck("1 555 555 5555")
should return true.");'
+ testString: assert(telephoneCheck("1 555 555 5555") === true);
- text: telephoneCheck("1 456 789 4444")
应该返回true。
- testString: 'assert(telephoneCheck("1 456 789 4444") === true, "telephoneCheck("1 456 789 4444")
should return true.");'
+ testString: assert(telephoneCheck("1 456 789 4444") === true);
- text: 'telephoneCheck("123**&!!asdf#")
应该返回false。'
- testString: 'assert(telephoneCheck("123**&!!asdf#") === false, "telephoneCheck("123**&!!asdf#")
should return false.");'
+ testString: assert(telephoneCheck("123**&!!asdf#") === false);
- text: telephoneCheck("55555555")
应该返回false。
- testString: 'assert(telephoneCheck("55555555") === false, "telephoneCheck("55555555")
should return false.");'
+ testString: assert(telephoneCheck("55555555") === false);
- text: telephoneCheck("(6054756961)")
应该返回false
- testString: 'assert(telephoneCheck("(6054756961)") === false, "telephoneCheck("(6054756961)")
should return false");'
+ testString: assert(telephoneCheck("(6054756961)") === false);
- text: telephoneCheck("2 (757) 622-7382")
应该返回false。
- testString: 'assert(telephoneCheck("2 (757) 622-7382") === false, "telephoneCheck("2 (757) 622-7382")
should return false.");'
+ testString: assert(telephoneCheck("2 (757) 622-7382") === false);
- text: telephoneCheck("0 (757) 622-7382")
应该返回false。
- testString: 'assert(telephoneCheck("0 (757) 622-7382") === false, "telephoneCheck("0 (757) 622-7382")
should return false.");'
+ testString: assert(telephoneCheck("0 (757) 622-7382") === false);
- text: telephoneCheck("-1 (757) 622-7382")
应该返回false
- testString: 'assert(telephoneCheck("-1 (757) 622-7382") === false, "telephoneCheck("-1 (757) 622-7382")
should return false");'
+ testString: assert(telephoneCheck("-1 (757) 622-7382") === false);
- text: telephoneCheck("2 757 622-7382")
应该返回false。
- testString: 'assert(telephoneCheck("2 757 622-7382") === false, "telephoneCheck("2 757 622-7382")
should return false.");'
+ testString: assert(telephoneCheck("2 757 622-7382") === false);
- text: telephoneCheck("10 (757) 622-7382")
应该返回false。
- testString: 'assert(telephoneCheck("10 (757) 622-7382") === false, "telephoneCheck("10 (757) 622-7382")
should return false.");'
+ testString: assert(telephoneCheck("10 (757) 622-7382") === false);
- text: telephoneCheck("27576227382")
应该返回false。
- testString: 'assert(telephoneCheck("27576227382") === false, "telephoneCheck("27576227382")
should return false.");'
+ testString: assert(telephoneCheck("27576227382") === false);
- text: telephoneCheck("(275)76227382")
应该返回false。
- testString: 'assert(telephoneCheck("(275)76227382") === false, "telephoneCheck("(275)76227382")
should return false.");'
+ testString: assert(telephoneCheck("(275)76227382") === false);
- text: telephoneCheck("2(757)6227382")
应该返回false。
- testString: 'assert(telephoneCheck("2(757)6227382") === false, "telephoneCheck("2(757)6227382")
should return false.");'
+ testString: assert(telephoneCheck("2(757)6227382") === false);
- text: telephoneCheck("2(757)622-7382")
应该返回false。
- testString: 'assert(telephoneCheck("2(757)622-7382") === false, "telephoneCheck("2(757)622-7382")
should return false.");'
+ testString: assert(telephoneCheck("2(757)622-7382") === false);
- text: telephoneCheck("555)-555-5555")
应该返回false。
- testString: 'assert(telephoneCheck("555)-555-5555") === false, "telephoneCheck("555)-555-5555")
should return false.");'
+ testString: assert(telephoneCheck("555)-555-5555") === false);
- text: telephoneCheck("(555-555-5555")
应该返回false。
- testString: 'assert(telephoneCheck("(555-555-5555") === false, "telephoneCheck("(555-555-5555")
should return false.");'
+ testString: assert(telephoneCheck("(555-555-5555") === false);
- text: telephoneCheck("(555)5(55?)-5555")
应该返回false。
- testString: 'assert(telephoneCheck("(555)5(55?)-5555") === false, "telephoneCheck("(555)5(55?)-5555")
should return false.");'
+ testString: assert(telephoneCheck("(555)5(55?)-5555") === false);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/add-methods-after-inheritance.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/add-methods-after-inheritance.chinese.md
index e2ad66c9f9..0efa00ce96 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/add-methods-after-inheritance.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/add-methods-after-inheritance.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 继承后添加方法
```yml
tests:
- text: Animal
不应该响应bark()
方法。
- testString: 'assert(typeof Animal.prototype.bark == "undefined", "Animal
should not respond to the bark()
method.");'
+ testString: assert(typeof Animal.prototype.bark == "undefined");
- text: Dog
应该继承Animal
的eat()
方法。
- testString: 'assert(typeof Dog.prototype.eat == "function", "Dog
should inherit the eat()
method from Animal
.");'
+ testString: assert(typeof Dog.prototype.eat == "function");
- text: Dog
应该将bark()
方法作为own
属性。
- testString: 'assert(Dog.prototype.hasOwnProperty("bark"), "Dog
should have the bark()
method as an own
property.");'
+ testString: assert(Dog.prototype.hasOwnProperty('bark'));
- text: beagle
应该是Animal
一个instanceof
。
- testString: 'assert(beagle instanceof Animal, "beagle
should be an instanceof
Animal
.");'
+ testString: assert(beagle instanceof Animal);
- text: beagle
的构造函数应该设置为Dog
。
- testString: 'assert(beagle.constructor === Dog, "The constructor for beagle
should be set to Dog
.");'
+ testString: assert(beagle.constructor === Dog);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.chinese.md
index a90394af9b..637a01f0d8 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 将Prototype更改为新对象
```yml
tests:
- text: Dog.prototype
应该设置为一个新对象。
- testString: 'assert((/Dog\.prototype\s*?=\s*?{/).test(code), "Dog.prototype
should be set to a new object.");'
+ testString: assert((/Dog\.prototype\s*?=\s*?{/).test(code));
- text: Dog.prototype
应该具有属性numLegs
。
- testString: 'assert(Dog.prototype.numLegs !== undefined, "Dog.prototype
should have the property numLegs
.");'
+ testString: assert(Dog.prototype.numLegs !== undefined);
- text: Dog.prototype
应该有方法eat()
。
- testString: 'assert(typeof Dog.prototype.eat === "function", "Dog.prototype
should have the method eat()
."); '
+ testString: assert(typeof Dog.prototype.eat === 'function');
- text: Dog.prototype
应该有方法describe()
。
- testString: 'assert(typeof Dog.prototype.describe === "function", "Dog.prototype
should have the method describe()
."); '
+ testString: assert(typeof Dog.prototype.describe === 'function');
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/create-a-basic-javascript-object.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/create-a-basic-javascript-object.chinese.md
index 5bc6b4c781..91e0f8d62d 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/create-a-basic-javascript-object.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/create-a-basic-javascript-object.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 创建一个基本的JavaScript对象
```yml
tests:
- text: dog
应该是一个object
。
- testString: 'assert(typeof(dog) === "object", "dog
should be an object
.");'
+ testString: assert(typeof(dog) === 'object');
- text: dog
应该将name
属性设置为string
。
- testString: 'assert(typeof(dog.name) === "string", "dog
should have a name
property set to a string
.");'
+ testString: assert(typeof(dog.name) === 'string');
- text: dog
应该将numLegs
属性设置为number
。
- testString: 'assert(typeof(dog.numLegs) === "number", "dog
should have a numLegs
property set to a number
.");'
+ testString: assert(typeof(dog.numLegs) === 'number');
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/create-a-method-on-an-object.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/create-a-method-on-an-object.chinese.md
index 556add061a..73b64fab0f 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/create-a-method-on-an-object.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/create-a-method-on-an-object.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 在对象上创建方法
```yml
tests:
- text: dog.sayLegs()
应该是一个函数。
- testString: 'assert(typeof(dog.sayLegs) === "function", "dog.sayLegs()
should be a function.");'
+ testString: assert(typeof(dog.sayLegs) === 'function');
- text: dog.sayLegs()
应返回给定的字符串 - 请注意标点符号和间距很重要。
- testString: 'assert(dog.sayLegs() === "This dog has 4 legs.", "dog.sayLegs()
should return the given string - note that punctuation and spacing matter.");'
+ testString: assert(dog.sayLegs() === 'This dog has 4 legs.');
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/define-a-constructor-function.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/define-a-constructor-function.chinese.md
index 0a3be3c164..5e168cfb0d 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/define-a-constructor-function.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/define-a-constructor-function.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 定义构造函数
```yml
tests:
- text: Dog
应该将name
属性设置为字符串。
- testString: 'assert(typeof (new Dog()).name === "string", "Dog
should have a name
property set to a string.");'
+ testString: assert(typeof (new Dog()).name === 'string');
- text: Dog
应该将color
属性设置为字符串。
- testString: 'assert(typeof (new Dog()).color === "string", "Dog
should have a color
property set to a string.");'
+ testString: assert(typeof (new Dog()).color === 'string');
- text: Dog
应该将numLegs
属性设置为数字。
- testString: 'assert(typeof (new Dog()).numLegs === "number", "Dog
should have a numLegs
property set to a number.");'
+ testString: assert(typeof (new Dog()).numLegs === 'number');
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/extend-constructors-to-receive-arguments.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/extend-constructors-to-receive-arguments.chinese.md
index 6a0776c913..6c8816dcbc 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/extend-constructors-to-receive-arguments.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/extend-constructors-to-receive-arguments.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 扩展构造函数以接收参数
```yml
tests:
- text: Dog
应该收到name
的论据。
- testString: 'assert((new Dog("Clifford")).name === "Clifford", "Dog
should receive an argument for name
.");'
+ testString: assert((new Dog('Clifford')).name === 'Clifford');
- text: Dog
应该收到color
的论据。
- testString: 'assert((new Dog("Clifford", "yellow")).color === "yellow", "Dog
should receive an argument for color
.");'
+ testString: assert((new Dog('Clifford', 'yellow')).color === 'yellow');
- text: Dog
应该将属性numLegs
设置为4。
- testString: 'assert((new Dog("Clifford")).numLegs === 4, "Dog
should have property numLegs
set to 4.");'
+ testString: assert((new Dog('Clifford')).numLegs === 4);
- text: 应该使用Dog
构造函数创建terrier
。
- testString: 'assert(terrier instanceof Dog, "terrier
should be created using the Dog
constructor.");'
+ testString: assert(terrier instanceof Dog);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.chinese.md
index 7c42262fb8..0e16259640 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 迭代所有属性
```yml
tests:
- text: ownProps
数组应包含"name"
。
- testString: 'assert(ownProps.indexOf("name") !== -1, "The ownProps
array should include "name"
.");'
+ testString: assert(ownProps.indexOf('name') !== -1);
- text: prototypeProps
数组应该包含"numLegs"
。
- testString: 'assert(prototypeProps.indexOf("numLegs") !== -1, "The prototypeProps
array should include "numLegs"
.");'
+ testString: assert(prototypeProps.indexOf('numLegs') !== -1);
- text: 无需使用内置方法Object.keys()
即可解决此挑战。
- testString: 'assert(!/\Object.keys/.test(code), "Solve this challenge without using the built in method Object.keys()
.");'
+ testString: assert(!/\Object.keys/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.chinese.md
index 9874c36fa7..ca72cba2e9 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用此关键字使代码更可重用
```yml
tests:
- text: dog.sayLegs()
应该返回给定的字符串。
- testString: 'assert(dog.sayLegs() === "This dog has 4 legs.", "dog.sayLegs()
should return the given string.");'
+ testString: assert(dog.sayLegs() === 'This dog has 4 legs.');
- text: 您的代码应使用this
关键字来访问dog
的numLegs
属性。
- testString: 'assert(code.match(/this\.numLegs/g), "Your code should use the this
keyword to access the numLegs
property of dog
.");'
+ testString: assert(code.match(/this\.numLegs/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/override-inherited-methods.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/override-inherited-methods.chinese.md
index fdc2448cf4..55508fac41 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/override-inherited-methods.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/override-inherited-methods.chinese.md
@@ -3,7 +3,7 @@ id: 587d7db1367417b2b2512b88
title: Override Inherited Methods
challengeType: 1
videoUrl: ''
-localeTitle: ''
+localeTitle: 重写继承的方法
---
## Description
@@ -18,9 +18,9 @@ localeTitle: ''
```yml
tests:
- text: penguin.fly()
应该返回字符串“唉,这是一只不会飞的鸟”。
- testString: 'assert(penguin.fly() === "Alas, this is a flightless bird.", "penguin.fly()
should return the string "Alas, this is a flightless bird."");'
+ testString: assert(penguin.fly() === "Alas, this is a flightless bird.");
- text: bird.fly()
方法应该返回“我正在飞行!”
- testString: 'assert((new Bird()).fly() === "I am flying!", "The bird.fly()
method should return "I am flying!"");'
+ testString: assert((new Bird()).fly() === "I am flying!");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/remember-to-set-the-constructor-property-when-changing-the-prototype.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/remember-to-set-the-constructor-property-when-changing-the-prototype.chinese.md
index 26969b1c38..83415bfaa8 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/remember-to-set-the-constructor-property-when-changing-the-prototype.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/remember-to-set-the-constructor-property-when-changing-the-prototype.chinese.md
@@ -18,7 +18,7 @@ localeTitle: 请记住在更改原型时设置构造函数属性
```yml
tests:
- text: Dog.prototype
应该设置constructor
属性。
- testString: 'assert(Dog.prototype.constructor === Dog, "Dog.prototype
should set the constructor
property.");'
+ testString: assert(Dog.prototype.constructor === Dog);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/reset-an-inherited-constructor-property.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/reset-an-inherited-constructor-property.chinese.md
index 47e76a2594..41997a4cfa 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/reset-an-inherited-constructor-property.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/reset-an-inherited-constructor-property.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 重置继承的构造函数属性
```yml
tests:
- text: Bird.prototype
应该是Animal
一个实例。
- testString: 'assert(Animal.prototype.isPrototypeOf(Bird.prototype), "Bird.prototype
should be an instance of Animal
.");'
+ testString: assert(Animal.prototype.isPrototypeOf(Bird.prototype));
- text: duck.constructor
应该返回Bird
。
- testString: 'assert(duck.constructor === Bird, "duck.constructor
should return Bird
.");'
+ testString: assert(duck.constructor === Bird);
- text: Dog.prototype
应该是Animal
一个实例。
- testString: 'assert(Animal.prototype.isPrototypeOf(Dog.prototype), "Dog.prototype
should be an instance of Animal
.");'
+ testString: assert(Animal.prototype.isPrototypeOf(Dog.prototype));
- text: beagle.constructor
应该返回Dog
。
- testString: 'assert(beagle.constructor === Dog, "beagle.constructor
should return Dog
.");'
+ testString: assert(beagle.constructor === Dog);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/set-the-childs-prototype-to-an-instance-of-the-parent.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/set-the-childs-prototype-to-an-instance-of-the-parent.chinese.md
index bdb2dd082f..c7fadea698 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/set-the-childs-prototype-to-an-instance-of-the-parent.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/set-the-childs-prototype-to-an-instance-of-the-parent.chinese.md
@@ -18,7 +18,7 @@ localeTitle: 将Child的Prototype设置为Parent的实例
```yml
tests:
- text: Dog.prototype
应该是Animal
一个实例。
- testString: 'assert(Animal.prototype.isPrototypeOf(Dog.prototype), "Dog.prototype
should be an instance of Animal
.");'
+ testString: assert(Animal.prototype.isPrototypeOf(Dog.prototype));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.chinese.md
index ce85d552cd..1b57ebcb6e 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 了解自己的属性
```yml
tests:
- text: ownProps
应包含值"numLegs"
和"name"
。
- testString: 'assert(ownProps.indexOf("name") !== -1 && ownProps.indexOf("numLegs") !== -1, "ownProps
should include the values "numLegs"
and "name"
.");'
+ testString: assert(ownProps.indexOf("name") !== -1 && ownProps.indexOf("numLegs") !== -1);
- text: 无需使用内置方法Object.keys()
即可解决此挑战。
- testString: 'assert(!/\Object.keys/.test(code), "Solve this challenge without using the built in method Object.keys()
.");'
+ testString: assert(!/\Object.keys/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.chinese.md
index e76535ab88..a3ca4ddb1d 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 理解构造函数属性
```yml
tests:
- text: joinDogFraternity
应该被定义为一个函数。
- testString: 'assert(typeof(joinDogFraternity) === "function", "joinDogFraternity
should be defined as a function.");'
+ testString: assert(typeof(joinDogFraternity) === 'function');
- text: 如果candidate
是Dog
一个实例, joinDogFraternity
应该返回true。
- testString: 'assert(joinDogFraternity(new Dog("")) === true, "joinDogFraternity
should return true ifcandidate
is an instance of Dog
.");'
+ testString: assert(joinDogFraternity(new Dog("")) === true);
- text: joinDogFraternity
应该使用constructor
属性。
- testString: 'assert(/\.constructor/.test(code) && !/instanceof/.test(code), "joinDogFraternity
should use the constructor
property.");'
+ testString: assert(/\.constructor/.test(code) && !/instanceof/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.chinese.md
index c4f06168f1..543d98695e 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 理解立即调用的函数表达式(IIFE)
```yml
tests:
- text: 该功能应该是匿名的。
- testString: 'assert(/\(\s*?function\s*?\(\s*?\)\s*?{/.test(code), "The function should be anonymous.");'
+ testString: assert(/\((function|\(\))(=>|\(\)){/.test(code.replace(/\s/g, "")));
- text: 您的函数应在表达式的末尾加上括号以立即调用它。
- testString: 'assert(/}\s*?\)\s*?\(\s*?\)/.test(code), "Your function should have parentheses at the end of the expression to call it immediately.");'
+ testString: assert(/}\)\(\)/.test(code.replace(/\s/g, "")));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.chinese.md
index 3013153de7..db43b508f1 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.chinese.md
@@ -18,7 +18,7 @@ localeTitle: 理解原型链
```yml
tests:
- text: 您的代码应该显示Object.prototype
是原型Dog.prototype
“)
- testString: 'assert(/Object\.prototype\.isPrototypeOf/.test(code), "Your code should show that Object.prototype
is the prototype of Dog.prototype
");'
+ testString: assert(/Object\.prototype\.isPrototypeOf/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.chinese.md
index cea03cb74b..7112052c43 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.chinese.md
@@ -18,7 +18,7 @@ localeTitle: 了解对象原型的来源
```yml
tests:
- text: 证明Dog.prototype
是beagle
的prototype
- testString: 'assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(code), "Show that Dog.prototype
is the prototype
of beagle
");'
+ testString: assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.chinese.md
index 513f3c5743..200a071511 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用构造函数创建对象
```yml
tests:
- text: 应该使用Dog
构造函数创建hound
。
- testString: 'assert(hound instanceof Dog, "hound
should be created using the Dog
constructor.");'
+ testString: assert(hound instanceof Dog);
- text: 您的代码应该使用new
运算符来创建Dog
的instance
。
- testString: 'assert(code.match(/new/g), "Your code should use the new
operator to create an instance
of Dog
.");'
+ testString: assert(code.match(/new/g));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-mixin-to-add-common-behavior-between-unrelated-objects.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-mixin-to-add-common-behavior-between-unrelated-objects.chinese.md
index 1275774afb..bb1cdb3716 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-mixin-to-add-common-behavior-between-unrelated-objects.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-mixin-to-add-common-behavior-between-unrelated-objects.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 使用Mixin在不相关的对象之间添加常见行为
```yml
tests:
- text: 您的代码应该声明一个glideMixin
变量,它是一个函数。
- testString: 'assert(typeof glideMixin === "function", "Your code should declare a glideMixin
variable that is a function.");'
+ testString: assert(typeof glideMixin === "function");
- text: 你的代码应该使用bird
对象上的glideMixin
来为它提供glide
方法。
- testString: 'assert(typeof bird.glide === "function", "Your code should use the glideMixin
on the bird
object to give it the glide
method.");'
+ testString: assert(typeof bird.glide === "function");
- text: 你的代码应该使用boat
对象上的glideMixin
来为它提供glide
方法。
- testString: 'assert(typeof boat.glide === "function", "Your code should use the glideMixin
on the boat
object to give it the glide
method.");'
+ testString: assert(typeof boat.glide === "function");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-an-iife-to-create-a-module.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-an-iife-to-create-a-module.chinese.md
index 52bd64f51b..331441490f 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-an-iife-to-create-a-module.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-an-iife-to-create-a-module.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 使用IIFE创建模块
```yml
tests:
- text: 应该定义funModule
并返回一个对象。
- testString: 'assert(typeof funModule === "object", "funModule
should be defined and return an object.");'
+ testString: assert(typeof funModule === "object");
- text: funModule.isCuteMixin
应该访问一个函数。
- testString: 'assert(typeof funModule.isCuteMixin === "function", "funModule.isCuteMixin
should access a function.");'
+ testString: assert(typeof funModule.isCuteMixin === "function");
- text: funModule.singMixin
应该访问一个函数。
- testString: 'assert(typeof funModule.singMixin === "function", "funModule.singMixin
should access a function.");'
+ testString: assert(typeof funModule.singMixin === "function");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.chinese.md
index e5147a02af..d74f325c07 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用点表示法访问对象的属性
```yml
tests:
- text: 您应该使用console.log
来打印dog
对象的name
属性的值。
- testString: 'assert(/console.log\(.*dog\.name.*\)/g.test(code), "Your should use console.log
to print the value for the name
property of the dog
object.");'
+ testString: assert(/console.log\(.*dog\.name.*\)/g.test(code));
- text: 您应该使用console.log
来打印dog
对象的numLegs
属性的值。
- testString: 'assert(/console.log\(.*dog\.numLegs.*\)/g.test(code), "Your should use console.log
to print the value for the numLegs
property of the dog
object.");'
+ testString: assert(/console.log\(.*dog\.numLegs.*\)/g.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-inheritance-so-you-dont-repeat-yourself.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-inheritance-so-you-dont-repeat-yourself.chinese.md
index 2d0654dfbd..abc82f4202 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-inheritance-so-you-dont-repeat-yourself.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-inheritance-so-you-dont-repeat-yourself.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 使用继承,所以你不要重复自己
```yml
tests:
- text: Animal.prototype
应该有eat
属性。
- testString: 'assert(Animal.prototype.hasOwnProperty("eat"), "Animal.prototype
should have the eat
property.");'
+ testString: assert(Animal.prototype.hasOwnProperty('eat'));
- text: Bear.prototype
不应该有eat
属性。
- testString: 'assert(!(Bear.prototype.hasOwnProperty("eat")), "Bear.prototype
should not have the eat
property.");'
+ testString: assert(!(Bear.prototype.hasOwnProperty('eat')));
- text: Cat.prototype
不应该有eat
属性。
- testString: 'assert(!(Cat.prototype.hasOwnProperty("eat")), "Cat.prototype
should not have the eat
property.");'
+ testString: assert(!(Cat.prototype.hasOwnProperty('eat')));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-prototype-properties-to-reduce-duplicate-code.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-prototype-properties-to-reduce-duplicate-code.chinese.md
index 45f4ffd876..64e4235084 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-prototype-properties-to-reduce-duplicate-code.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-prototype-properties-to-reduce-duplicate-code.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 使用原型属性来减少重复代码
```yml
tests:
- text: beagle
应该有一个numLegs
财产。
- testString: 'assert(beagle.numLegs !== undefined, "beagle
should have a numLegs
property.");'
+ testString: assert(beagle.numLegs !== undefined);
- text: beagle.numLegs
应该是一个数字。
- testString: 'assert(typeof(beagle.numLegs) === "number" , "beagle.numLegs
should be a number.");'
+ testString: assert(typeof(beagle.numLegs) === 'number' );
- text: numLegs
应该是prototype
属性而不是own
属性。
- testString: 'assert(beagle.hasOwnProperty("numLegs") === false, "numLegs
should be a prototype
property not an own
property.");'
+ testString: assert(beagle.hasOwnProperty('numLegs') === false);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.chinese.md
index 29f2f0645b..1f3efa83c9 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用instanceof验证Object的构造函数
```yml
tests:
- text: myHouse
应该将numBedrooms
属性设置为数字。
- testString: 'assert(typeof myHouse.numBedrooms === "number", "myHouse
should have a numBedrooms
attribute set to a number.");'
+ testString: assert(typeof myHouse.numBedrooms === 'number');
- text: 请务必使用instanceof
运算符验证myHouse
是House
的instanceof
。
- testString: 'assert(/myHouse\s*instanceof\s*House/.test(code), "Be sure to verify that myHouse
is an instance of House
using the instanceof
operator.");'
+ testString: assert(/myHouse\s*instanceof\s*House/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-all-or-none.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-all-or-none.chinese.md
index d9d1c25889..dd5e809d98 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-all-or-none.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-all-or-none.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 检查全部或无
```yml
tests:
- text: 你的正则表达式应该使用可选的符号, ?
。
- testString: 'assert(favRegex.source.match(/\?/).length > 0, "Your regex should use the optional symbol, ?
.");'
+ testString: assert(favRegex.source.match(/\?/).length > 0);
- text: 你的正则表达式应该匹配"favorite"
- testString: 'assert(favRegex.test("favorite"), "Your regex should match "favorite"
");'
+ testString: assert(favRegex.test("favorite"));
- text: 你的正则表达式应该匹配"favourite"
- testString: 'assert(favRegex.test("favourite"), "Your regex should match "favourite"
");'
+ testString: assert(favRegex.test("favourite"));
- text: 你的正则表达式不应该匹配"fav"
- testString: 'assert(!favRegex.test("fav"), "Your regex should not match "fav"
");'
+ testString: assert(!favRegex.test("fav"));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.chinese.md
index 1978d0a4bb..8767835b8b 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 提取匹配
```yml
tests:
- text: result
应该有单词coding
- testString: 'assert(result.join() === "coding", "The result
should have the word coding
");'
+ testString: assert(result.join() === "coding");
- text: 你的regex codingRegex
应该搜索coding
- testString: 'assert(codingRegex.source === "coding", "Your regex codingRegex
should search for coding
");'
+ testString: assert(codingRegex.source === "coding");
- text: 您应该使用.match()
方法。
- testString: 'assert(code.match(/\.match\(.*\)/), "You should use the .match()
method.");'
+ testString: assert(code.match(/\.match\(.*\)/));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/find-more-than-the-first-match.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/find-more-than-the-first-match.chinese.md
index e3dba77259..2192d10495 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/find-more-than-the-first-match.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/find-more-than-the-first-match.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 找到比第一场比赛更多的东西
```yml
tests:
- text: 你的正则表达式starRegex
应该使用全局标志g
- testString: 'assert(starRegex.flags.match(/g/).length == 1, "Your regex starRegex
should use the global flag g
");'
+ testString: assert(starRegex.flags.match(/g/).length == 1);
- text: 你的正则表达式starRegex
应该使用不区分大小写的标志i
- testString: 'assert(starRegex.flags.match(/i/).length == 1, "Your regex starRegex
should use the case insensitive flag i
");'
+ testString: assert(starRegex.flags.match(/i/).length == 1);
- text: 您的匹配应匹配"Twinkle"
一词的出现次数
- testString: 'assert(result.sort().join() == twinkleStar.match(/twinkle/gi).sort().join(), "Your match should match both occurrences of the word "Twinkle"
");'
+ testString: assert(result.sort().join() == twinkleStar.match(/twinkle/gi).sort().join());
- text: 您的匹配result
应该包含两个元素。
- testString: 'assert(result.length == 2, "Your match result
should have two elements in it.");'
+ testString: assert(result.length == 2);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.chinese.md
index 4c91e24795..578fa8f9bd 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/find-one-or-more-criminals-in-a-hunt.chinese.md
@@ -18,19 +18,19 @@ localeTitle: 在狩猎中找到一个或多个罪犯
```yml
tests:
- text: 您正则表达式应该匹配one
犯罪(“ C
中”), "C"
- testString: 'assert("C".match(reCriminals) && "C".match(reCriminals)[0] == "C", "Your regex should match one
criminal ("C
") in "C"
");'
+ testString: assert('C'.match(reCriminals) && 'C'.match(reCriminals)[0] == 'C');
- text: 您正则表达式应该匹配two
罪犯(“ CC
中”) "CC"
- testString: 'assert("CC".match(reCriminals) && "CC".match(reCriminals)[0] == "CC", "Your regex should match two
criminals ("CC
") in "CC"
");'
+ testString: assert('CC'.match(reCriminals) && 'CC'.match(reCriminals)[0] == 'CC');
- text: 你的正则表达式应匹配"P1P5P4CCCP2P6P3"
中的three
罪犯(“ CCC
”)
- testString: 'assert("P1P5P4CCCP2P6P3".match(reCriminals) && "P1P5P4CCCP2P6P3".match(reCriminals)[0] == "CCC", "Your regex should match three
criminals ("CCC
") in "P1P5P4CCCP2P6P3"
");'
+ testString: assert('P1P5P4CCCP2P6P3'.match(reCriminals) && 'P1P5P4CCCP2P6P3'.match(reCriminals)[0] == 'CCC');
- text: 你的正则表达式应匹配"P6P2P7P4P5CCCCCP3P1"
中的five
罪犯(“ CCCCC
”)
- testString: 'assert("P6P2P7P4P5CCCCCP3P1".match(reCriminals) && "P6P2P7P4P5CCCCCP3P1".match(reCriminals)[0] == "CCCCC", "Your regex should match five
criminals ("CCCCC
") in "P6P2P7P4P5CCCCCP3P1"
");'
+ testString: assert('P6P2P7P4P5CCCCCP3P1'.match(reCriminals) && 'P6P2P7P4P5CCCCCP3P1'.match(reCriminals)[0] == 'CCCCC');
- text: 你的正则表达式不应该匹配""
中的任何罪犯
- testString: 'assert(!reCriminals.test(""), "Your regex should not match any criminals in ""
");'
+ testString: assert(!reCriminals.test(''));
- text: 你的正则表达式不应该匹配"P1P2P3"
中的任何罪犯
- testString: 'assert(!reCriminals.test("P1P2P3"), "Your regex should not match any criminals in "P1P2P3"
");'
+ testString: assert(!reCriminals.test('P1P2P3'));
- text: 您正则表达式应该与fifty
的罪犯(“ CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
中”) "P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3"
。
- testString: 'assert("P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3".match(reCriminals) && "P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3".match(reCriminals)[0] == "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC", "Your regex should match fifty
criminals ("CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
") in "P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3"
.");'
+ testString: assert('P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3'.match(reCriminals) && 'P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3'.match(reCriminals)[0] == "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC");
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.chinese.md
index b6b9f4f141..2d1637609f 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/ignore-case-while-matching.chinese.md
@@ -18,25 +18,25 @@ localeTitle: 匹配时忽略大小写
```yml
tests:
- text: 你的正则表达式应该与freeCodeCamp
匹配
- testString: 'assert(fccRegex.test("freeCodeCamp"), "Your regex should match freeCodeCamp
");'
+ testString: assert(fccRegex.test('freeCodeCamp'));
- text: 你的正则表达式应该与FreeCodeCamp
匹配
- testString: 'assert(fccRegex.test("FreeCodeCamp"), "Your regex should match FreeCodeCamp
");'
+ testString: assert(fccRegex.test('FreeCodeCamp'));
- text: 你的正则表达式应该与FreecodeCamp
匹配
- testString: 'assert(fccRegex.test("FreecodeCamp"), "Your regex should match FreecodeCamp
");'
+ testString: assert(fccRegex.test('FreecodeCamp'));
- text: 你的正则表达式应该与FreeCodecamp
匹配
- testString: 'assert(fccRegex.test("FreeCodecamp"), "Your regex should match FreeCodecamp
");'
+ testString: assert(fccRegex.test('FreeCodecamp'));
- text: 你的正则表达式不应该与Free Code Camp
不匹配
- testString: 'assert(!fccRegex.test("Free Code Camp"), "Your regex should not match Free Code Camp
");'
+ testString: assert(!fccRegex.test('Free Code Camp'));
- text: 你的正则表达式应该与FreeCOdeCamp
匹配
- testString: 'assert(fccRegex.test("FreeCOdeCamp"), "Your regex should match FreeCOdeCamp
");'
+ testString: assert(fccRegex.test('FreeCOdeCamp'));
- text: 你的正则表达式不应该与FCC
匹配
- testString: 'assert(!fccRegex.test("FCC"), "Your regex should not match FCC
");'
+ testString: assert(!fccRegex.test('FCC'));
- text: 你的正则表达式应该与FrEeCoDeCamp
匹配
- testString: 'assert(fccRegex.test("FrEeCoDeCamp"), "Your regex should match FrEeCoDeCamp
");'
+ testString: assert(fccRegex.test('FrEeCoDeCamp'));
- text: 你的正则表达式应该与FrEeCodECamp
匹配
- testString: 'assert(fccRegex.test("FrEeCodECamp"), "Your regex should match FrEeCodECamp
");'
+ testString: assert(fccRegex.test('FrEeCodECamp'));
- text: 你的正则表达式应该与FReeCodeCAmp
匹配
- testString: 'assert(fccRegex.test("FReeCodeCAmp"), "Your regex should match FReeCodeCAmp
");'
+ testString: assert(fccRegex.test('FReeCodeCAmp'));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.chinese.md
index 53eb174c40..946c0a019e 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities.chinese.md
@@ -18,19 +18,19 @@ localeTitle: 匹配具有不同可能性的文字字符串
```yml
tests:
- text: 你的正则表达式petRegex
应该为字符串"John has a pet dog."
返回true
"John has a pet dog."
- testString: 'assert(petRegex.test("John has a pet dog."), "Your regex petRegex
should return true
for the string "John has a pet dog."
");'
+ testString: assert(petRegex.test('John has a pet dog.'));
- text: 你的正则表达式petRegex
应该为字符串"Emma has a pet rock."
返回false
"Emma has a pet rock."
- testString: 'assert(!petRegex.test("Emma has a pet rock."), "Your regex petRegex
should return false
for the string "Emma has a pet rock."
");'
+ testString: assert(!petRegex.test('Emma has a pet rock.'));
- text: 你的正则表达式petRegex
应该为字符串"Emma has a pet bird."
返回true
"Emma has a pet bird."
- testString: 'assert(petRegex.test("Emma has a pet bird."), "Your regex petRegex
should return true
for the string "Emma has a pet bird."
");'
+ testString: assert(petRegex.test('Emma has a pet bird.'));
- text: 你的正则表达式petRegex
应该返回true
为字符串"Liz has a pet cat."
- testString: 'assert(petRegex.test("Liz has a pet cat."), "Your regex petRegex
should return true
for the string "Liz has a pet cat."
");'
+ testString: assert(petRegex.test('Liz has a pet cat.'));
- text: 你的正则表达式petRegex
应该返回false
为"Kara has a pet dolphin."
的字符串"Kara has a pet dolphin."
- testString: 'assert(!petRegex.test("Kara has a pet dolphin."), "Your regex petRegex
should return false
for the string "Kara has a pet dolphin."
");'
+ testString: assert(!petRegex.test('Kara has a pet dolphin.'));
- text: 你的正则表达式petRegex
应该返回true
为字符串"Alice has a pet fish."
- testString: 'assert(petRegex.test("Alice has a pet fish."), "Your regex petRegex
should return true
for the string "Alice has a pet fish."
");'
+ testString: assert(petRegex.test('Alice has a pet fish.'));
- text: 你的正则表达式petRegex
应该返回false
为字符串"Jimmy has a pet computer."
- testString: 'assert(!petRegex.test("Jimmy has a pet computer."), "Your regex petRegex
should return false
for the string "Jimmy has a pet computer."
");'
+ testString: assert(!petRegex.test('Jimmy has a pet computer.'));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-letters-and-numbers.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-letters-and-numbers.chinese.md
index 976dd34ce9..c4e5dca2f3 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-letters-and-numbers.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-letters-and-numbers.chinese.md
@@ -18,17 +18,17 @@ localeTitle: 匹配所有字母和数字
```yml
tests:
- text: 你的正则表达式应该使用全局标志。
- testString: 'assert(alphabetRegexV2.global, "Your regex should use the global flag.");'
+ testString: assert(alphabetRegexV2.global);
- text: 你的正则表达式应该使用速记字符
- testString: 'assert(/\\w/.test(alphabetRegexV2.source), "Your regex should use the shorthand character \w
to match all characters which are alphanumeric.");'
+ testString: assert(/\\w/.test(alphabetRegexV2.source));
- text: 你的正则表达式应该在"The five boxing wizards jump quickly."
找到31个字母数字字符"The five boxing wizards jump quickly."
- testString: 'assert("The five boxing wizards jump quickly.".match(alphabetRegexV2).length === 31, "Your regex should find 31 alphanumeric characters in "The five boxing wizards jump quickly."
");'
+ testString: assert("The five boxing wizards jump quickly.".match(alphabetRegexV2).length === 31);
- text: 你的正则表达式应该在"Pack my box with five dozen liquor jugs."
找到32个字母数字字符"Pack my box with five dozen liquor jugs."
- testString: 'assert("Pack my box with five dozen liquor jugs.".match(alphabetRegexV2).length === 32, "Your regex should find 32 alphanumeric characters in "Pack my box with five dozen liquor jugs."
");'
+ testString: assert("Pack my box with five dozen liquor jugs.".match(alphabetRegexV2).length === 32);
- text: 你的正则表达式应该在"How vexingly quick daft zebras jump!"
找到30个字母数字字符"How vexingly quick daft zebras jump!"
- testString: 'assert("How vexingly quick daft zebras jump!".match(alphabetRegexV2).length === 30, "Your regex should find 30 alphanumeric characters in "How vexingly quick daft zebras jump!"
");'
+ testString: assert("How vexingly quick daft zebras jump!".match(alphabetRegexV2).length === 30);
- text: 你的正则表达式应该在"123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ."
找到36个字母数字字符"123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ."
- testString: 'assert("123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.".match(alphabetRegexV2).length === 36, "Your regex should find 36 alphanumeric characters in "123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ."
");'
+ testString: assert("123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.".match(alphabetRegexV2).length === 36);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-non-numbers.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-non-numbers.chinese.md
index 377c2ace4b..1ed91ec69a 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-non-numbers.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-non-numbers.chinese.md
@@ -18,21 +18,21 @@ localeTitle: 匹配所有非数字
```yml
tests:
- text: 您的正则表达式应使用快捷方式字符来匹配非数字字符
- testString: 'assert(/\\D/.test(noNumRegex.source), "Your regex should use the shortcut character to match non-digit characters");'
+ testString: assert(/\\D/.test(noNumRegex.source));
- text: 你的正则表达式应该使用全局标志。
- testString: 'assert(noNumRegex.global, "Your regex should use the global flag.");'
+ testString: assert(noNumRegex.global);
- text: 你的正则表达式应该在"9"
找不到非数字。
- testString: 'assert("9".match(noNumRegex) == null, "Your regex should find no non-digits in "9"
.");'
+ testString: assert("9".match(noNumRegex) == null);
- text: 你的正则表达式应该在"Catch 22"
找到6个非数字。
- testString: 'assert("Catch 22".match(noNumRegex).length == 6, "Your regex should find 6 non-digits in "Catch 22"
.");'
+ testString: assert("Catch 22".match(noNumRegex).length == 6);
- text: 你的正则表达式应该在"101 Dalmatians"
找到11个非数字。
- testString: 'assert("101 Dalmatians".match(noNumRegex).length == 11, "Your regex should find 11 non-digits in "101 Dalmatians"
.");'
+ testString: assert("101 Dalmatians".match(noNumRegex).length == 11);
- text: '你的正则表达式应该在"One, Two, Three"
找到15个非数字。'
- testString: 'assert("One, Two, Three".match(noNumRegex).length == 15, "Your regex should find 15 non-digits in "One, Two, Three"
.");'
+ testString: assert("One, Two, Three".match(noNumRegex).length == 15);
- text: 你的正则表达式应该在"21 Jump Street"
找到12个非数字。
- testString: 'assert("21 Jump Street".match(noNumRegex).length == 12, "Your regex should find 12 non-digits in "21 Jump Street"
.");'
+ testString: assert("21 Jump Street".match(noNumRegex).length == 12);
- text: '你的正则表达式应该在"2001: A Space Odyssey"
找到17个非数字。'
- testString: 'assert("2001: A Space Odyssey".match(noNumRegex).length == 17, "Your regex should find 17 non-digits in "2001: A Space Odyssey"
.");'
+ testString: 'assert("2001: A Space Odyssey".match(noNumRegex).length == 17);'
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-numbers.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-numbers.chinese.md
index b5eec2a5bd..20ebb47955 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-numbers.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-all-numbers.chinese.md
@@ -18,21 +18,21 @@ localeTitle: 匹配所有号码
```yml
tests:
- text: 您的正则表达式应使用快捷方式字符来匹配数字字符
- testString: 'assert(/\\d/.test(numRegex.source), "Your regex should use the shortcut character to match digit characters");'
+ testString: assert(/\\d/.test(numRegex.source));
- text: 你的正则表达式应该使用全局标志。
- testString: 'assert(numRegex.global, "Your regex should use the global flag.");'
+ testString: assert(numRegex.global);
- text: 你的正则表达式应该在"9"
找到1位数。
- testString: 'assert("9".match(numRegex).length == 1, "Your regex should find 1 digit in "9"
.");'
+ testString: assert("9".match(numRegex).length == 1);
- text: 你的正则表达式应该在"Catch 22"
找到2位数字。
- testString: 'assert("Catch 22".match(numRegex).length == 2, "Your regex should find 2 digits in "Catch 22"
.");'
+ testString: assert("Catch 22".match(numRegex).length == 2);
- text: 你的正则表达式应该在"101 Dalmatians"
找到3位数字。
- testString: 'assert("101 Dalmatians".match(numRegex).length == 3, "Your regex should find 3 digits in "101 Dalmatians"
.");'
+ testString: assert("101 Dalmatians".match(numRegex).length == 3);
- text: '你的正则表达式应该在"One, Two, Three"
找不到数字。'
- testString: 'assert("One, Two, Three".match(numRegex) == null, "Your regex should find no digits in "One, Two, Three"
.");'
+ testString: assert("One, Two, Three".match(numRegex) == null);
- text: 您的正则表达式应该在"21 Jump Street"
找到2位数字。
- testString: 'assert("21 Jump Street".match(numRegex).length == 2, "Your regex should find 2 digits in "21 Jump Street"
.");'
+ testString: assert("21 Jump Street".match(numRegex).length == 2);
- text: '你的正则表达式应该在"2001: A Space Odyssey"
找到4位数字。'
- testString: 'assert("2001: A Space Odyssey".match(numRegex).length == 4, "Your regex should find 4 digits in "2001: A Space Odyssey"
.");'
+ testString: 'assert("2001: A Space Odyssey".match(numRegex).length == 4);'
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.chinese.md
index 152064ac2a..8eaab97c23 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.chinese.md
@@ -18,25 +18,25 @@ localeTitle: 匹配通配符期间的任何内容
```yml
tests:
- text: 您应该使用.test()
方法。
- testString: 'assert(code.match(/\.test\(.*\)/), "You should use the .test()
method.");'
+ testString: assert(code.match(/\.test\(.*\)/));
- text: 您应该在正则表达式unRegex
使用通配符
- testString: 'assert(/\./.test(unRegex.source), "You should use the wildcard character in your regex unRegex
");'
+ testString: assert(/\./.test(unRegex.source));
- text: 你的正则表达式unRegex
应该匹配"run"
"Let us go on a run."
"run"
中的"run"
"Let us go on a run."
- testString: 'assert(unRegex.test("Let us go on a run."), "Your regex unRegex
should match "run"
in "Let us go on a run."
");'
+ testString: assert(unRegex.test("Let us go on a run."));
- text: 你的正则表达式unRegex
应该与"sun"
"The sun is out today."
"sun"
中的"sun"
匹配"The sun is out today."
- testString: 'assert(unRegex.test("The sun is out today."), "Your regex unRegex
should match "sun"
in "The sun is out today."
");'
+ testString: assert(unRegex.test("The sun is out today."));
- text: 你的正则表达式unRegex
应该与"fun"
"Coding is a lot of fun."
"fun"
中的"fun"
匹配"Coding is a lot of fun."
- testString: 'assert(unRegex.test("Coding is a lot of fun."), "Your regex unRegex
should match "fun"
in "Coding is a lot of fun."
");'
+ testString: assert(unRegex.test("Coding is a lot of fun."));
- text: 你的正则表达式unRegex
应该匹配"pun"
"Seven days without a pun makes one weak."
"pun"
"Seven days without a pun makes one weak."
- testString: 'assert(unRegex.test("Seven days without a pun makes one weak."), "Your regex unRegex
should match "pun"
in "Seven days without a pun makes one weak."
");'
+ testString: assert(unRegex.test("Seven days without a pun makes one weak."));
- text: 你的正则表达式unRegex
应该与"nun"
"One takes a vow to be a nun."
"nun"
中的"nun"
匹配"One takes a vow to be a nun."
- testString: 'assert(unRegex.test("One takes a vow to be a nun."), "Your regex unRegex
should match "nun"
in "One takes a vow to be a nun."
");'
+ testString: assert(unRegex.test("One takes a vow to be a nun."));
- text: 你的正则表达式unRegex
应该匹配"bun"
"She got fired from the hot dog stand for putting her hair in a bun."
"bun"
中的"bun"
"She got fired from the hot dog stand for putting her hair in a bun."
- testString: 'assert(unRegex.test("She got fired from the hot dog stand for putting her hair in a bun."), "Your regex unRegex
should match "bun"
in "She got fired from the hot dog stand for putting her hair in a bun."
");'
+ testString: assert(unRegex.test("She got fired from the hot dog stand for putting her hair in a bun."));
- text: 您的正则表达式unRegex
不应与"There is a bug in my code."
匹配"There is a bug in my code."
- testString: 'assert(!unRegex.test("There is a bug in my code."), "Your regex unRegex
should not match "There is a bug in my code."
");'
+ testString: assert(!unRegex.test("There is a bug in my code."));
- text: 您的正则表达式unRegex
不应该匹配"Catch me if you can."
- testString: 'assert(!unRegex.test("Can me if you can."), "Your regex unRegex
should not match "Catch me if you can."
");'
+ testString: assert(!unRegex.test("Can me if you can."));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.chinese.md
index 83a18dfc8c..99eb6afbf9 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-beginning-string-patterns.chinese.md
@@ -18,13 +18,13 @@ localeTitle: 匹配开始字符串模式
```yml
tests:
- text: 你的正则表达式应该用大写字母搜索"Cal"
。
- testString: 'assert(calRegex.source == "^Cal", "Your regex should search for "Cal"
with a capital letter.");'
+ testString: assert(calRegex.source == "^Cal");
- text: 你的正则表达式不应该使用任何标志。
- testString: 'assert(calRegex.flags == "", "Your regex should not use any flags.");'
+ testString: assert(calRegex.flags == "");
- text: 你的正则表达式应该匹配字符串开头的"Cal"
。
- testString: 'assert(calRegex.test("Cal and Ricky both like racing."), "Your regex should match "Cal"
at the beginning of the string.");'
+ testString: assert(calRegex.test("Cal and Ricky both like racing."));
- text: 您的正则表达式不应与字符串中间的"Cal"
匹配。
- testString: 'assert(!calRegex.test("Ricky and Cal both like racing."), "Your regex should not match "Cal"
in the middle of a string.");'
+ testString: assert(!calRegex.test("Ricky and Cal both like racing."));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-one-or-more-times.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-one-or-more-times.chinese.md
index f8a6dd7f52..e56dfb0de9 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-one-or-more-times.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-one-or-more-times.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 匹配出现一次或多次的字符
```yml
tests:
- text: 你的正则表达式myRegex
应该使用+
符号来匹配一个或多个s
字符。
- testString: 'assert(/\+/.test(myRegex.source), "Your regex myRegex
should use the +
sign to match one or more s
characters.");'
+ testString: assert(/\+/.test(myRegex.source));
- text: 你的正则表达式myRegex
应该匹配2个项目。
- testString: 'assert(result.length == 2, "Your regex myRegex
should match 2 items.");'
+ testString: assert(result.length == 2);
- text: result
变量应该是一个包含两个匹配"ss"
的数组
- testString: 'assert(result[0] == "ss" && result[1] == "ss", "The result
variable should be an array with two matches of "ss"
");'
+ testString: assert(result[0] == 'ss' && result[1] == 'ss');
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.chinese.md
index 6e52e6742b..728a7fb179 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 匹配出现零次或多次的字符
```yml
tests:
- text: 您正则表达式chewieRegex
应该使用*
字符匹配零个或多个a
字符。
- testString: 'assert(/\*/.test(chewieRegex.source), "Your regex chewieRegex
should use the *
character to match zero or more a
characters.");'
+ testString: assert(/\*/.test(chewieRegex.source));
- text: 你的正则表达式chewieRegex
应匹配16个字符。
- testString: 'assert(result[0].length === 16, "Your regex chewieRegex
should match 16 characters.");'
+ testString: assert(result[0].length === 16);
- text: 你的正则表达式应该匹配"Aaaaaaaaaaaaaaaa"
。
- testString: 'assert(result[0] === "Aaaaaaaaaaaaaaaa", "Your regex should match "Aaaaaaaaaaaaaaaa"
.");'
+ testString: assert(result[0] === "Aaaaaaaaaaaaaaaa");
- text: '你的正则表达式不应该与"He made a fair move. Screaming about it can't help you."
中的任何角色相匹配"He made a fair move. Screaming about it can't help you."
'
- testString: 'assert(!"He made a fair move. Screaming about it can\"t help you.".match(chewieRegex), "Your regex should not match any characters in "He made a fair move. Screaming about it can't help you."
");'
+ testString: assert(!"He made a fair move. Screaming about it can\"t help you.".match(chewieRegex));
- text: '你的正则表达式不应该与"Let him have it. It's not wise to upset a Wookiee."
中的任何角色相匹配"Let him have it. It's not wise to upset a Wookiee."
'
- testString: 'assert(!"Let him have it. It\"s not wise to upset a Wookiee.".match(chewieRegex), "Your regex should not match any characters in "Let him have it. It's not wise to upset a Wookiee."
");'
+ testString: assert(!"Let him have it. It\"s not wise to upset a Wookiee.".match(chewieRegex));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.chinese.md
index 539370e6f4..9b60c346f7 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 匹配结束字符串模式
```yml
tests:
- text: 您应该在正则表达式中使用美元符号$
anchor搜索"caboose"
。
- testString: 'assert(lastRegex.source == "caboose$", "You should search for "caboose"
with the dollar sign $
anchor in your regex.");'
+ testString: assert(lastRegex.source == "caboose$");
- text: 你的正则表达式不应该使用任何标志。
- testString: 'assert(lastRegex.flags == "", "Your regex should not use any flags.");'
+ testString: assert(lastRegex.flags == "");
- text: 您应该在字符串末尾匹配"caboose"
"The last car on a train is the caboose"
- testString: 'assert(lastRegex.test("The last car on a train is the caboose"), "You should match "caboose"
at the end of the string "The last car on a train is the caboose"
");'
+ testString: assert(lastRegex.test("The last car on a train is the caboose"));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-everything-but-letters-and-numbers.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-everything-but-letters-and-numbers.chinese.md
index b0cd164bed..b32e9df7d9 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-everything-but-letters-and-numbers.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-everything-but-letters-and-numbers.chinese.md
@@ -18,17 +18,17 @@ localeTitle: 匹配一切,但字母和数字
```yml
tests:
- text: 你的正则表达式应该使用全局标志。
- testString: 'assert(nonAlphabetRegex.global, "Your regex should use the global flag.");'
+ testString: assert(nonAlphabetRegex.global);
- text: 你的正则表达式应该在"The five boxing wizards jump quickly."
找到6个非字母数字字符"The five boxing wizards jump quickly."
。
- testString: 'assert("The five boxing wizards jump quickly.".match(nonAlphabetRegex).length == 6, "Your regex should find 6 non-alphanumeric characters in "The five boxing wizards jump quickly."
.");'
+ testString: assert("The five boxing wizards jump quickly.".match(nonAlphabetRegex).length == 6);
- text: 你的正则表达式应该使用速记字符。
- testString: 'assert(/\\W/.test(nonAlphabetRegex.source), "Your regex should use the shorthand character to match characters which are non-alphanumeric.");'
+ testString: assert(/\\W/.test(nonAlphabetRegex.source));
- text: 你的正则表达式应该在"Pack my box with five dozen liquor jugs."
找到8个非字母数字字符"Pack my box with five dozen liquor jugs."
- testString: 'assert("Pack my box with five dozen liquor jugs.".match(nonAlphabetRegex).length == 8, "Your regex should find 8 non-alphanumeric characters in "Pack my box with five dozen liquor jugs."
");'
+ testString: assert("Pack my box with five dozen liquor jugs.".match(nonAlphabetRegex).length == 8);
- text: 你的正则表达式应该在"How vexingly quick daft zebras jump!"
找到6个非字母数字字符"How vexingly quick daft zebras jump!"
- testString: 'assert("How vexingly quick daft zebras jump!".match(nonAlphabetRegex).length == 6, "Your regex should find 6 non-alphanumeric characters in "How vexingly quick daft zebras jump!"
");'
+ testString: assert("How vexingly quick daft zebras jump!".match(nonAlphabetRegex).length == 6);
- text: 你的正则表达式应该在"123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ."
找到12个非字母数字字符"123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ."
- testString: 'assert("123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.".match(nonAlphabetRegex).length == 12, "Your regex should find 12 non-alphanumeric characters in "123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ."
");'
+ testString: assert("123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.".match(nonAlphabetRegex).length == 12);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-letters-of-the-alphabet.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-letters-of-the-alphabet.chinese.md
index 6518172fde..19a2680c06 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-letters-of-the-alphabet.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-letters-of-the-alphabet.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 匹配字母的字母
```yml
tests:
- text: 你的正则表达式alphabetRegex
应该匹配35项。
- testString: 'assert(result.length == 35, "Your regex alphabetRegex
should match 35 items.");'
+ testString: assert(result.length == 35);
- text: 你的正则表达式alphabetRegex
应该使用全局标志。
- testString: 'assert(alphabetRegex.flags.match(/g/).length == 1, "Your regex alphabetRegex
should use the global flag.");'
+ testString: assert(alphabetRegex.flags.match(/g/).length == 1);
- text: 你的正则表达式alphabetRegex
应该使用不区分大小写的标志。
- testString: 'assert(alphabetRegex.flags.match(/i/).length == 1, "Your regex alphabetRegex
should use the case insensitive flag.");'
+ testString: assert(alphabetRegex.flags.match(/i/).length == 1);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.chinese.md
index 5dee8d7a7f..ed6e4b6e8e 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 匹配文字字符串
```yml
tests:
- text: 你的正则表达式waldoRegex
应该找到"Waldo"
- testString: 'assert(waldoRegex.test(waldoIsHiding), "Your regex waldoRegex
should find "Waldo"
");'
+ testString: assert(waldoRegex.test(waldoIsHiding));
- text: 你的正则表达式waldoRegex
不应该搜索任何其他内容。
- testString: 'assert(!waldoRegex.test("Somewhere is hiding in this text."), "Your regex waldoRegex
should not search for anything else.");'
+ testString: assert(!waldoRegex.test('Somewhere is hiding in this text.'));
- text: 您应该与正则表达式执行文字字符串匹配。
- testString: 'assert(!/\/.*\/i/.test(code), "You should perform a literal string match with your regex.");'
+ testString: assert(!/\/.*\/i/.test(code));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-non-whitespace-characters.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-non-whitespace-characters.chinese.md
index 9befd76abb..5d06a082d2 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-non-whitespace-characters.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-non-whitespace-characters.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 匹配非空白字符
```yml
tests:
- text: 你的正则表达式应该使用全局标志。
- testString: 'assert(countNonWhiteSpace.global, "Your regex should use the global flag.");'
+ testString: assert(countNonWhiteSpace.global);
- text: 你的正则表达式应该使用速记字符
- testString: 'assert(/\\S/.test(countNonWhiteSpace.source), "Your regex should use the shorthand character \S/code> to match all non-whitespace characters.");'
+ testString: assert(/\\S/.test(countNonWhiteSpace.source));
- text: 你的正则表达式应该在
elements have closing tags.");'
+ testString: assert(code.match(/<\/button>/g) && code.match(/"Men are from Mars and women are from Venus."
找到35个非空格"Men are from Mars and women are from Venus."
- testString: 'assert("Men are from Mars and women are from Venus.".match(countNonWhiteSpace).length == 35, "Your regex should find 35 non-spaces in "Men are from Mars and women are from Venus."
");'
+ testString: assert("Men are from Mars and women are from Venus.".match(countNonWhiteSpace).length == 35);
- text: '你的正则表达式应该在"Space: the final frontier."
找到23个非空格"Space: the final frontier."
'
- testString: 'assert("Space: the final frontier.".match(countNonWhiteSpace).length == 23, "Your regex should find 23 non-spaces in "Space: the final frontier."
");'
+ testString: 'assert("Space: the final frontier.".match(countNonWhiteSpace).length == 23);'
- text: 你的正则表达式应该在"MindYourPersonalSpace"
找到21个非空格
- testString: 'assert("MindYourPersonalSpace".match(countNonWhiteSpace).length == 21, "Your regex should find 21 non-spaces in "MindYourPersonalSpace"
");'
+ testString: assert("MindYourPersonalSpace".match(countNonWhiteSpace).length == 21);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-numbers-and-letters-of-the-alphabet.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-numbers-and-letters-of-the-alphabet.chinese.md
index d05f61cc08..83018df411 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-numbers-and-letters-of-the-alphabet.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-numbers-and-letters-of-the-alphabet.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 匹配数字和字母的字母
```yml
tests:
- text: 你的正则表达式myRegex
应该匹配17项。
- testString: 'assert(result.length == 17, "Your regex myRegex
should match 17 items.");'
+ testString: assert(result.length == 17);
- text: 你的正则表达式myRegex
应该使用全局标志。
- testString: 'assert(myRegex.flags.match(/g/).length == 1, "Your regex myRegex
should use the global flag.");'
+ testString: assert(myRegex.flags.match(/g/).length == 1);
- text: 你的正则表达式myRegex
应该使用不区分大小写的标志。
- testString: 'assert(myRegex.flags.match(/i/).length == 1, "Your regex myRegex
should use the case insensitive flag.");'
+ testString: assert(myRegex.flags.match(/i/).length == 1);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-single-character-with-multiple-possibilities.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-single-character-with-multiple-possibilities.chinese.md
index 8ef1ddbd67..47ef6237a4 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-single-character-with-multiple-possibilities.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-single-character-with-multiple-possibilities.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 将单个角色与多种可能性相匹配
```yml
tests:
- text: 你应该找到所有25个元音。
- testString: 'assert(result.length == 25, "You should find all 25 vowels.");'
+ testString: assert(result.length == 25);
- text: 你的正则表达式vowelRegex
应该使用一个字符类。
- testString: 'assert(/\[.*\]/.test(vowelRegex.source), "Your regex vowelRegex
should use a character class.");'
+ testString: assert(/\[.*\]/.test(vowelRegex.source));
- text: 你的正则表达式vowelRegex
应该使用全局标志。
- testString: 'assert(vowelRegex.flags.match(/g/).length == 1, "Your regex vowelRegex
should use the global flag.");'
+ testString: assert(vowelRegex.flags.match(/g/).length == 1);
- text: 你的正则表达式vowelRegex
应该使用不区分大小写的标志。
- testString: 'assert(vowelRegex.flags.match(/i/).length == 1, "Your regex vowelRegex
should use the case insensitive flag.");'
+ testString: assert(vowelRegex.flags.match(/i/).length == 1);
- text: 你的正则表达式不应该与任何辅音匹配。
- testString: 'assert(!/[b-df-hj-np-tv-z]/gi.test(result.join()), "Your regex should not match any consonants.");'
+ testString: assert(!/[b-df-hj-np-tv-z]/gi.test(result.join()));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-single-characters-not-specified.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-single-characters-not-specified.chinese.md
index 96ab035515..b5fb7cf90a 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-single-characters-not-specified.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-single-characters-not-specified.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 匹配未指定的单个字符
```yml
tests:
- text: 你的正则表达式myRegex
应匹配9项。
- testString: 'assert(result.length == 9, "Your regex myRegex
should match 9 items.");'
+ testString: assert(result.length == 9);
- text: 你的正则表达式myRegex
应该使用全局标志。
- testString: 'assert(myRegex.flags.match(/g/).length == 1, "Your regex myRegex
should use the global flag.");'
+ testString: assert(myRegex.flags.match(/g/).length == 1);
- text: 你的正则表达式myRegex
应该使用不区分大小写的标志。
- testString: 'assert(myRegex.flags.match(/i/).length == 1, "Your regex myRegex
should use the case insensitive flag.");'
+ testString: assert(myRegex.flags.match(/i/).length == 1);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-whitespace.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-whitespace.chinese.md
index 595d79782c..72ed291067 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-whitespace.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-whitespace.chinese.md
@@ -18,15 +18,15 @@ localeTitle: 匹配空白
```yml
tests:
- text: 你的正则表达式应该使用全局标志。
- testString: 'assert(countWhiteSpace.global, "Your regex should use the global flag.");'
+ testString: assert(countWhiteSpace.global);
- text: 你的正则表达式应该使用速记字符
- testString: 'assert(/\\s/.test(countWhiteSpace.source), "Your regex should use the shorthand character \s
to match all whitespace characters.");'
+ testString: assert(/\\s/.test(countWhiteSpace.source));
- text: 你的正则表达式应该在"Men are from Mars and women are from Venus."
找到八个空格"Men are from Mars and women are from Venus."
- testString: 'assert("Men are from Mars and women are from Venus.".match(countWhiteSpace).length == 8, "Your regex should find eight spaces in "Men are from Mars and women are from Venus."
");'
+ testString: assert("Men are from Mars and women are from Venus.".match(countWhiteSpace).length == 8);
- text: '你的正则表达式应该在"Space: the final frontier."
找到三个空格"Space: the final frontier."
'
- testString: 'assert("Space: the final frontier.".match(countWhiteSpace).length == 3, "Your regex should find three spaces in "Space: the final frontier."
");'
- - text: ''
- testString: 'assert("MindYourPersonalSpace".match(countWhiteSpace) == null, "Your regex should find no spaces in "MindYourPersonalSpace"
");'
+ testString: 'assert("Space: the final frontier.".match(countWhiteSpace).length == 3);'
+ - text: 您的正则表达式应该在"MindYourPersonalSpace"
中找不到空格
+ testString: assert("MindYourPersonalSpace".match(countWhiteSpace) == null);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.chinese.md
index 9fd27dc587..8259110993 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead.chinese.md
@@ -18,21 +18,21 @@ localeTitle: 积极和消极的前瞻
```yml
tests:
- text: 你的正则表达式应该使用两个积极的lookaheads
。
- testString: 'assert(pwRegex.source.match(/\(\?=.*?\)\(\?=.*?\)/) !== null, "Your regex should use two positive lookaheads
.");'
+ testString: assert(pwRegex.source.match(/\(\?=.*?\)\(\?=.*?\)/) !== null);
- text: 你的正则表达式不应该匹配"astronaut"
- testString: 'assert(!pwRegex.test("astronaut"), "Your regex should not match "astronaut"
");'
+ testString: assert(!pwRegex.test("astronaut"));
- text: 你的正则表达式不应该与"airplanes"
匹配
- testString: 'assert(!pwRegex.test("airplanes"), "Your regex should not match "airplanes"
");'
+ testString: assert(!pwRegex.test("airplanes"));
- text: 你的正则表达式不应该匹配"banan1"
- testString: 'assert(!pwRegex.test("banan1"), "Your regex should not match "banan1"
");'
+ testString: assert(!pwRegex.test("banan1"));
- text: 你的正则表达式应该匹配"bana12"
- testString: 'assert(pwRegex.test("bana12"), "Your regex should match "bana12"
");'
+ testString: assert(pwRegex.test("bana12"));
- text: 你的正则表达式应该匹配"abc123"
- testString: 'assert(pwRegex.test("abc123"), "Your regex should match "abc123"
");'
+ testString: assert(pwRegex.test("abc123"));
- text: 你的正则表达式不应该匹配"123"
- testString: 'assert(!pwRegex.test("123"), "Your regex should not match "123"
");'
+ testString: assert(!pwRegex.test("123"));
- text: 你的正则表达式不应该匹配"1234"
- testString: 'assert(!pwRegex.test("1234"), "Your regex should not match "1234"
");'
+ testString: assert(!pwRegex.test("1234"));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.chinese.md
index 99324defe6..0be4b80612 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 从开始和结束中删除空格
```yml
tests:
- text: 'result
应该等于"Hello, World!"
'
- testString: 'assert(result == "Hello, World!", "result
should equal to "Hello, World!"
");'
+ testString: assert(result == "Hello, World!");
- text: 您不应该使用.trim()
方法。
- testString: 'assert(!code.match(/\.trim\(.*?\)/), "You should not use the .trim()
method.");'
+ testString: assert(!code.match(/\.trim\([\s\S]*?\)/));
- text: result
变量不应设置为等于字符串。
- testString: 'assert(!code.match(/result\s*=\s*".*?"/), "The result
variable should not be set equal to a string.");'
+ testString: assert(!code.match(/result\s*=\s*".*?"/));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.chinese.md
index 008d867706..4c6ae7056d 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups.chinese.md
@@ -18,25 +18,25 @@ localeTitle: 使用捕获组重用模式
```yml
tests:
- text: 你的正则表达式应该使用数字的速记字符类。
- testString: 'assert(reRegex.source.match(/\\d/), "Your regex should use the shorthand character class for digits.");'
+ testString: assert(reRegex.source.match(/\\d/));
- text: 您的正则表达式应该重复使用捕获组两次。
- testString: 'assert(reRegex.source.match(/\\\d/g).length === 2, "Your regex should reuse the capture group twice.");'
+ testString: assert(reRegex.source.match(/\\1|\\2/g).length >= 2);
- text: 你的正则表达式应该有两个空格来分隔这三个数字。
- testString: 'assert(reRegex.source.match(/\\s/g).length === 2, "Your regex should have two spaces separating the three numbers.");'
+ testString: assert(reRegex.source.match(/ |\\s/g).length === 2 || reRegex.source.match(/\(\\s\)(?=.*\\(1|2))/g));
- text: 你的正则表达式应该匹配"42 42 42"
。
- testString: 'assert(reRegex.test("42 42 42"), "Your regex should match "42 42 42"
.");'
+ testString: assert(reRegex.test("42 42 42"));
- text: 你的正则表达式应该匹配"100 100 100"
。
- testString: 'assert(reRegex.test("100 100 100"), "Your regex should match "100 100 100"
.");'
+ testString: assert(reRegex.test("100 100 100"));
- text: 你的正则表达式不应该匹配"42 42 42 42"
。
- testString: 'assert.equal(("42 42 42 42").match(reRegex.source), null, "Your regex should not match "42 42 42 42"
.");'
+ testString: assert.equal(("42 42 42 42").match(reRegex.source), null);
- text: 你的正则表达式不应该匹配"42 42"
。
- testString: 'assert.equal(("42 42").match(reRegex.source), null, "Your regex should not match "42 42"
.");'
+ testString: assert.equal(("42 42").match(reRegex.source), null);
- text: 你的正则表达式不应该匹配"101 102 103"
。
- testString: 'assert(!reRegex.test("101 102 103"), "Your regex should not match "101 102 103"
.");'
+ testString: assert(!reRegex.test("101 102 103"));
- text: 你的正则表达式不应该匹配"1 2 3"
。
- testString: 'assert(!reRegex.test("1 2 3"), "Your regex should not match "1 2 3"
.");'
+ testString: assert(!reRegex.test("1 2 3"));
- text: 你的正则表达式应匹配"10 10 10"
。
- testString: 'assert(reRegex.test("10 10 10"), "Your regex should match "10 10 10"
.");'
+ testString: assert(reRegex.test("10 10 10"));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-exact-number-of-matches.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-exact-number-of-matches.chinese.md
index 7b3bd5110b..4d0be9ba21 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-exact-number-of-matches.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-exact-number-of-matches.chinese.md
@@ -18,17 +18,17 @@ localeTitle: 指定完全匹配数
```yml
tests:
- text: 你的正则表达式应该使用大括号。
- testString: 'assert(timRegex.source.match(/{.*?}/).length > 0, "Your regex should use curly brackets.");'
+ testString: assert(timRegex.source.match(/{.*?}/).length > 0);
- text: 你的正则表达式不应该与"Timber"
匹配
- testString: 'assert(!timRegex.test("Timber"), "Your regex should not match "Timber"
");'
+ testString: assert(!timRegex.test("Timber"));
- text: 你的正则表达式不应该匹配"Timmber"
- testString: 'assert(!timRegex.test("Timmber"), "Your regex should not match "Timmber"
");'
+ testString: assert(!timRegex.test("Timmber"));
- text: 你的正则表达式不应该匹配"Timmmber"
- testString: 'assert(!timRegex.test("Timmmber"), "Your regex should not match "Timmmber"
");'
+ testString: assert(!timRegex.test("Timmmber"));
- text: 你的正则表达式应该匹配"Timmmmber"
- testString: 'assert(timRegex.test("Timmmmber"), "Your regex should match "Timmmmber"
");'
+ testString: assert(timRegex.test("Timmmmber"));
- text: 你的正则表达式不应该与30 m
的"Timber"
相匹配。
- testString: 'assert(!timRegex.test("Ti" + "m".repeat(30) + "ber"), "Your regex should not match "Timber"
with 30 m
\"s in it.");'
+ testString: assert(!timRegex.test("Ti" + "m".repeat(30) + "ber"));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.chinese.md
index 115eccc9be..902c4b0550 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches.chinese.md
@@ -18,19 +18,19 @@ localeTitle: 仅指定较低的匹配数
```yml
tests:
- text: 你的正则表达式应该使用大括号。
- testString: 'assert(haRegex.source.match(/{.*?}/).length > 0, "Your regex should use curly brackets.");'
+ testString: assert(haRegex.source.match(/{.*?}/).length > 0);
- text: 你的正则表达式不应该与"Hazzah"
匹配
- testString: 'assert(!haRegex.test("Hazzah"), "Your regex should not match "Hazzah"
");'
+ testString: assert(!haRegex.test("Hazzah"));
- text: 你的正则表达式不应该与"Hazzzah"
匹配
- testString: 'assert(!haRegex.test("Hazzzah"), "Your regex should not match "Hazzzah"
");'
+ testString: assert(!haRegex.test("Hazzzah"));
- text: 你的正则表达应该匹配"Hazzzzah"
- testString: 'assert(haRegex.test("Hazzzzah"), "Your regex should match "Hazzzzah"
");'
+ testString: assert("Hazzzzah".match(haRegex)[0].length === 8);
- text: 你的正则表达应该匹配"Hazzzzzah"
- testString: 'assert(haRegex.test("Hazzzzzah"), "Your regex should match "Hazzzzzah"
");'
+ testString: assert("Hazzzzzah".match(haRegex)[0].length === 9);
- text: 你的正则表达应该匹配"Hazzzzzzah"
- testString: 'assert(haRegex.test("Hazzzzzzah"), "Your regex should match "Hazzzzzzah"
");'
+ testString: assert("Hazzzzzzah".match(haRegex)[0].length === 10);
- text: 你的正则表达式应该匹配"Hazzah"
和30个z
。
- testString: 'assert(haRegex.test("Ha" + "z".repeat(30) + "ah"), "Your regex should match "Hazzah"
with 30 z
\"s in it.");'
+ testString: assert("Hazzzzzzzzzzzzzzzzzzzzzzzzzzzzzzah".match(haRegex)[0].length === 34);
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.chinese.md
index 18079acdfa..f3a3ba6635 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/specify-upper-and-lower-number-of-matches.chinese.md
@@ -18,19 +18,19 @@ localeTitle: 指定上下匹配数
```yml
tests:
- text: 你的正则表达式应该使用大括号。
- testString: 'assert(ohRegex.source.match(/{.*?}/).length > 0, "Your regex should use curly brackets.");'
+ testString: assert(ohRegex.source.match(/{.*?}/).length > 0);
- text: 你的正则表达式不应该匹配"Ohh no"
- testString: 'assert(!ohRegex.test("Ohh no"), "Your regex should not match "Ohh no"
");'
+ testString: assert(!ohRegex.test("Ohh no"));
- text: 你的正则表达式应该匹配"Ohhh no"
- testString: 'assert(ohRegex.test("Ohhh no"), "Your regex should match "Ohhh no"
");'
+ testString: assert("Ohhh no".match(ohRegex)[0].length === 7);
- text: 你的正则表达式应该匹配"Ohhhh no"
- testString: 'assert(ohRegex.test("Ohhhh no"), "Your regex should match "Ohhhh no"
");'
+ testString: assert("Ohhhh no".match(ohRegex)[0].length === 8);
- text: 你的正则表达式应该匹配"Ohhhhh no"
- testString: 'assert(ohRegex.test("Ohhhhh no"), "Your regex should match "Ohhhhh no"
");'
+ testString: assert("Ohhhhh no".match(ohRegex)[0].length === 9);
- text: 你的正则表达式应该匹配"Ohhhhhh no"
- testString: 'assert(ohRegex.test("Ohhhhhh no"), "Your regex should match "Ohhhhhh no"
");'
+ testString: assert("Ohhhhhh no".match(ohRegex)[0].length === 10);
- text: 你的正则表达式不应该匹配"Ohhhhhhh no"
- testString: 'assert(!ohRegex.test("Ohhhhhhh no"), "Your regex should not match "Ohhhhhhh no"
");'
+ testString: assert(!ohRegex.test("Ohhhhhhh no"));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.chinese.md
index 155ba7acca..38ad41f3ae 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.chinese.md
@@ -18,11 +18,11 @@ localeTitle: 使用捕获组进行搜索和替换
```yml
tests:
- text: 您应该使用.replace()
来搜索和替换。
- testString: 'assert(code.match(/\.replace\(.*\)/), "You should use .replace()
to search and replace.");'
+ testString: assert(code.match(/\.replace\(.*\)/));
- text: 你的正则表达式应该改变"This sandwich is good."
"This sandwich is okey-dokey."
- testString: 'assert(result == "This sandwich is okey-dokey." && replaceText === "okey-dokey", "Your regex should change "This sandwich is good."
to "This sandwich is okey-dokey."
");'
+ testString: assert(result == "This sandwich is okey-dokey." && replaceText === "okey-dokey");
- text: 你不应该改变最后一行。
- testString: 'assert(code.match(/result\s*=\s*huhText\.replace\(.*?\)/), "You should not change the last line.");'
+ testString: assert(code.match(/result\s*=\s*huhText\.replace\(.*?\)/));
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.chinese.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.chinese.md
index 9f3db92a6d..39ec98f161 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.chinese.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.chinese.md
@@ -18,9 +18,9 @@ localeTitle: 使用测试方法
```yml
tests:
- text: 你应该使用.test()
来测试正则表达式。
- testString: 'assert(code.match(/myRegex.test\(\s*myString\s*\)/), "You should use .test()
to test the regex.");'
+ testString: assert(code.match(/myRegex.test\(\s*myString\s*\)/));
- text: 您的结果应该返回true
。
- testString: 'assert(result === true, "Your result should return true
.");'
+ testString: assert(result === true);
```
diff --git a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/add-elements-within-your-bootstrap-wells.chinese.md b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/add-elements-within-your-bootstrap-wells.chinese.md
index 6a12c50bc1..ba585587c0 100644
--- a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/add-elements-within-your-bootstrap-wells.chinese.md
+++ b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/add-elements-within-your-bootstrap-wells.chinese.md
@@ -19,11 +19,11 @@ localeTitle: 在Bootstrap Wells中添加元素
```yml
tests:
- text: 在每个div
元素中嵌入三个button
元素,并且类well
。
- testString: 'assert($("div.well:eq(0)").children("button").length === 3 && $("div.well:eq(1)").children("button").length === 3, "Nest three button
elements within each of your div
elements with class well
.");'
+ testString: assert($("div.well:eq(0)").children("button").length === 3 && $("div.well:eq(1)").children("button").length === 3);
- text: 你应该总共有6个button
元素。
- testString: 'assert($("button") && $("button").length > 5, "You should have a total of 6 button
elements.");'
+ testString: assert($("button") && $("button").length > 5);
- text: 确保所有button
元素都有结束标记。
- testString: 'assert(code.match(/<\/button>/g) && code.match(/<i class="fa fa-info-circle"></i>
within your info button element.");'
+ testString: assert($(".btn-info > i").is(".fas.fa-info-circle") || $(".btn-info > span").is(".fas.fa-info-circle"));
- text: 您应该在删除按钮元素中添加<i class="fa fa-trash"></i>
。
- testString: 'assert($(".btn-danger > i").is(".fa.fa-trash") || $(".btn-danger > span").is(".fa.fa-trash"), "You should add a <i class="fa fa-trash"></i>
within your delete button element.");'
+ testString: assert($(".btn-danger > i").is(".fas.fa-trash") || $(".btn-danger > span").is(".fas.fa-trash"));
- text: 确保每个i
元素都有一个结束标记, <i class="fa fa-thumbs-up"></i>
就在你的按钮元素中。
- testString: 'assert(code.match(/<\/i>|<\/span/g) && code.match(/<\/i|<\/span>/g).length > 2 && ($(".btn-primary > i").is(".fa.fa-thumbs-up") || $(".btn-primary > span").is(".fa.fa-thumbs-up")), "Make sure each of your i
elements has a closing tag and <i class="fa fa-thumbs-up"></i>
is in your like button element.");'
+ testString: assert(code.match(/<\/i>|<\/span/g) && code.match(/<\/i|<\/span>/g).length > 2 && ($(".btn-primary > i").is(".fas.fa-thumbs-up") || $(".btn-primary > span").is(".fas.fa-thumbs-up")));
```
diff --git a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/add-font-awesome-icons-to-our-buttons.chinese.md b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/add-font-awesome-icons-to-our-buttons.chinese.md
index e48f2a31b4..e00deed70e 100644
--- a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/add-font-awesome-icons-to-our-buttons.chinese.md
+++ b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/add-font-awesome-icons-to-our-buttons.chinese.md
@@ -22,13 +22,13 @@ localeTitle: 添加字体真棒图标到我们的按钮
```yml
tests:
- text: 使用fa
和fa-thumbs-up
类添加i
元素。
- testString: 'assert($("i").is(".fa.fa-thumbs-up") || $("span").is(".fa.fa-thumbs-up"), "Add an i
element with the classes fa
and fa-thumbs-up
.");'
+ testString: assert($("i").is(".fas.fa-thumbs-up") || $("span").is(".fas.fa-thumbs-up"));
- text: 您的fa-thumbs-up
图标应位于Like按钮内。
- testString: 'assert(($("i.fa-thumbs-up").parent().text().match(/Like/gi) && $(".btn-primary > i").is(".fa.fa-thumbs-up")) || ($("span.fa-thumbs-up").parent().text().match(/Like/gi) && $(".btn-primary > span").is(".fa.fa-thumbs-up")), "Your fa-thumbs-up
icon should be located within the Like button.");'
+ testString: assert(($("i.fa-thumbs-up").parent().text().match(/Like/gi) && $(".btn-primary > i").is(".fas.fa-thumbs-up")) || ($("span.fa-thumbs-up").parent().text().match(/Like/gi) && $(".btn-primary > span").is(".fas.fa-thumbs-up")));
- text: 将您的i
元素嵌套在button
元素中。
- testString: 'assert($("button").children("i").length > 0 || $("button").children("span").length > 0, "Nest your i
element within your button
element.");'
+ testString: assert($("button").children("i").length > 0 || $("button").children("span").length > 0);
- text: 确保您的图标元素具有结束标记。
- testString: 'assert(code.match(/<\/i>|<\/span>/g), "Make sure your icon element has a closing tag.");'
+ testString: assert(code.match(/<\/i>|<\/span>/g));
```
diff --git a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/add-id-attributes-to-bootstrap-elements.chinese.md b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/add-id-attributes-to-bootstrap-elements.chinese.md
index a62d0501e7..889af7ad51 100644
--- a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/add-id-attributes-to-bootstrap-elements.chinese.md
+++ b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/add-id-attributes-to-bootstrap-elements.chinese.md
@@ -19,9 +19,9 @@ localeTitle: 将id属性添加到Bootstrap元素
```yml
tests:
- text: 给你留下well
的id left-well
。
- testString: 'assert($(".col-xs-6").children("#left-well") && $(".col-xs-6").children("#left-well").length > 0, "Give your left well
the id of left-well
.");'
+ testString: assert($(".col-xs-6").children("#left-well") && $(".col-xs-6").children("#left-well").length > 0);
- text: 给您的权利well
的ID right-well
。
- testString: 'assert($(".col-xs-6").children("#right-well") && $(".col-xs-6").children("#right-well").length > 0, "Give your right well
the id of right-well
.");'
+ testString: assert($(".col-xs-6").children("#right-well") && $(".col-xs-6").children("#right-well").length > 0);
```
diff --git a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/apply-the-default-bootstrap-button-style.chinese.md b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/apply-the-default-bootstrap-button-style.chinese.md
index c4883f01f5..11be169e42 100644
--- a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/apply-the-default-bootstrap-button-style.chinese.md
+++ b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/apply-the-default-bootstrap-button-style.chinese.md
@@ -19,9 +19,9 @@ localeTitle: 应用默认引导按钮样式
```yml
tests:
- text: 将btn
类应用于每个button
元素。
- testString: 'assert($(".btn").length > 5, "Apply the btn
class to each of your button
elements.");'
+ testString: assert($(".btn").length > 5);
- text: 将btn-default
类应用于每个button
元素。
- testString: 'assert($(".btn-default").length > 5, "Apply the btn-default
class to each of your button
elements.");'
+ testString: assert($(".btn-default").length > 5);
```
diff --git a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/call-out-optional-actions-with-btn-info.chinese.md b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/call-out-optional-actions-with-btn-info.chinese.md
index 5a8ce09872..5d1b214095 100644
--- a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/call-out-optional-actions-with-btn-info.chinese.md
+++ b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/call-out-optional-actions-with-btn-info.chinese.md
@@ -19,13 +19,13 @@ localeTitle: 使用btn-info调出可选操作
```yml
tests:
- text: 使用文本“Info”创建一个新的button
元素。
- testString: 'assert(new RegExp("info","gi").test($("button").text()), "Create a new button
element with the text "Info".");'
+ testString: assert(new RegExp("info","gi").test($("button").text()));
- text: 两个Bootstrap按钮都应该有btn
和btn-block
类。
- testString: 'assert($("button.btn-block.btn").length > 1, "Both of your Bootstrap buttons should have the btn
and btn-block
classes.");'
+ testString: assert($("button.btn-block.btn").length > 1);
- text: 你的新按钮应该有类btn-info
。
- testString: 'assert($("button").hasClass("btn-info"), "Your new button should have the class btn-info
.");'
+ testString: assert($("button").hasClass("btn-info"));
- text: 确保所有button
元素都有一个结束标记。
- testString: 'assert(code.match(/<\/button>/g) && code.match(/h2
元素居中
- testString: 'assert($("h2").hasClass("text-center"), "Your h2
element should be centered by applying the class text-center
");'
+ testString: assert($("h2").hasClass("text-center"));
- text: 您的h2
元素仍应具有类red-text
- testString: 'assert($("h2").hasClass("red-text"), "Your h2
element should still have the class red-text
");'
+ testString: assert($("h2").hasClass("red-text"));
```
diff --git a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/create-a-block-element-bootstrap-button.chinese.md b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/create-a-block-element-bootstrap-button.chinese.md
index 05f5f34227..3ac0c0c7fb 100644
--- a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/create-a-block-element-bootstrap-button.chinese.md
+++ b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/create-a-block-element-bootstrap-button.chinese.md
@@ -19,11 +19,11 @@ localeTitle: 创建一个块元素引导按钮
```yml
tests:
- text: 你的按钮应该仍然有btn
和btn-default
类。
- testString: 'assert($("button").hasClass("btn") && $("button").hasClass("btn-default"), "Your button should still have the btn
and btn-default
classes.");'
+ testString: assert($("button").hasClass("btn") && $("button").hasClass("btn-default"));
- text: 你的按钮应该有类btn-block
。
- testString: 'assert($("button").hasClass("btn-block"), "Your button should have the class btn-block
.");'
+ testString: assert($("button").hasClass("btn-block"));
- text: 确保所有button
元素都有一个结束标记。
- testString: 'assert(code.match(/<\/button>/g) && code.match(/button
element with the text "Like".");'
+ testString: assert(new RegExp("like","gi").test($("button").text()) && ($("img.img-responsive + button.btn").length > 0));
- text: 你的新按钮应该有两个类: btn
和btn-default
。
- testString: 'assert($("button").hasClass("btn") && $("button").hasClass("btn-default"), "Your new button should have two classes: btn
and btn-default
.");'
+ testString: assert($("button").hasClass("btn") && $("button").hasClass("btn-default"));
- text: 确保所有button
元素都有一个结束标记。
- testString: 'assert(code.match(/<\/button>/g) && code.match(/h3
element to your page.");'
+ testString: assert($("h3") && $("h3").length > 0);
- text: 确保您的h3
元素具有结束标记。
- testString: 'assert(code.match(/<\/h3>/g) && code.match(//g).length === code.match(/
h3 element has a closing tag.");'
+ testString: assert(code.match(/<\/h3>/g) && code.match(/
/g).length === code.match(/
text-primary类来对你的
h3
元素进行着色
- testString: 'assert($("h3").hasClass("text-primary"), "Your h3
element should be colored by applying the class text-primary
");'
+ testString: assert($("h3").hasClass("text-primary"));
- text: 应用类text-center
应该使h3
元素居中
- testString: 'assert($("h3").hasClass("text-center"), "Your h3
element should be centered by applying the class text-center
");'
+ testString: assert($("h3").hasClass("text-center"));
- text: 你的h3
元素应该有jQuery Playground
文本。
- testString: 'assert.isTrue((/jquery(\s)+playground/gi).test($("h3").text()), "Your h3
element should have the text jQuery Playground
.");'
+ testString: assert.isTrue((/jquery(\s)+playground/gi).test($("h3").text()));
```
diff --git a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/create-a-bootstrap-row.chinese.md b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/create-a-bootstrap-row.chinese.md
index 90f5fb257f..d5871c17a0 100644
--- a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/create-a-bootstrap-row.chinese.md
+++ b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/create-a-bootstrap-row.chinese.md
@@ -19,13 +19,13 @@ localeTitle: 创建一个Bootstrap行
```yml
tests:
- text: 在h3
元素下面添加一个div
元素。
- testString: 'assert(($("div").length > 1) && ($("div.row h3.text-primary").length == 0) && ($("div.row + h3.text-primary").length == 0) && ($("h3.text-primary + div.row").length > 0), "Add a div
element below your h3
element.");'
+ testString: assert(($("div").length > 1) && ($("div.row h3.text-primary").length == 0) && ($("div.row + h3.text-primary").length == 0) && ($("h3.text-primary + div.row").length > 0));
- text: 你的div
元素应该有类row
- testString: 'assert($("div").hasClass("row"), "Your div
element should have the class row
");'
+ testString: assert($("div").hasClass("row"));
- text: 你的row div
应该嵌套在container-fluid div
- testString: 'assert($("div.container-fluid div.row").length > 0, "Your row div
should be nested inside the container-fluid div
");'
+ testString: assert($("div.container-fluid div.row").length > 0);
- text: 确保你的div
元素有一个结束标记。
- testString: 'assert(code.match(/<\/div>/g) && code.match(/button
元素。
- testString: 'assert($(".target").length > 5, "Apply the target
class to each of your button
elements.");'
+ testString: assert($(".target").length > 5);
```
diff --git a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/create-a-custom-heading.chinese.md b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/create-a-custom-heading.chinese.md
index 827523b6f5..d7bbc4b628 100644
--- a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/create-a-custom-heading.chinese.md
+++ b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/create-a-custom-heading.chinese.md
@@ -19,13 +19,13 @@ localeTitle: 创建自定义标题
```yml
tests:
- text: 你的h2
元素和最顶层的img
元素都应该在带有类row
的div
元素中嵌套在一起。
- testString: 'assert($("div.row:has(h2)").length > 0 && $("div.row:has(img)").length > 0, "Your h2
element and topmost img
element should both be nested together within a div
element with the class row
.");'
+ testString: assert($("div.row:has(h2)").length > 0 && $("div.row:has(img)").length > 0);
- text: 使用类col-xs-4
将最顶层的img
元素嵌套在div
。
- testString: 'assert($("div.col-xs-4:has(img)").length > 0 && $("div.col-xs-4:has(div)").length === 0, "Nest your topmost img
element within a div
with the class col-xs-4
.");'
+ testString: assert($("div.col-xs-4:has(img)").length > 0 && $("div.col-xs-4:has(div)").length === 0);
- text: 使用类col-xs-8
将h2
元素嵌套在div
。
- testString: 'assert($("div.col-xs-8:has(h2)").length > 0 && $("div.col-xs-8:has(div)").length === 0, "Nest your h2
element within a div
with the class col-xs-8
.");'
+ testString: assert($("div.col-xs-8:has(h2)").length > 0 && $("div.col-xs-8:has(div)").length === 0);
- text: 确保每个div
元素都有一个结束标记。
- testString: 'assert(code.match(/<\/div>/g) && code.match(/well
内部的每个的div
与类元素"col-xs-6"
- testString: 'assert($("div.col-xs-6").not(":has(>div.well)").length < 1, "Add a div
element with the class well
inside each of your div
elements with the class "col-xs-6"
");'
+ testString: assert($("div.col-xs-6").not(":has(>div.well)").length < 1);
- text: 巢既您的div
与类元素"col-xs-6"
你中div
与类元素"row"
。
- testString: 'assert($("div.row > div.col-xs-6").length > 1, "Nest both of your div
elements with the class "col-xs-6"
within your div
element with the class "row"
.");'
+ testString: assert($("div.row > div.col-xs-6").length > 1);
- text: 确保所有div
元素都有结束标记。
- testString: 'assert(code.match(/<\/div>/g) && code.match(/red-text
.");'
+ testString: assert(!$("h2").hasClass("red-text"));
- text: 您的h2元素现在应该具有text-primary
类。
- testString: 'assert($("h2").hasClass("text-primary"), "Your h2 element should now have the class text-primary
.");'
+ testString: assert($("h2").hasClass("text-primary"));
- text: 您的段落元素不应再使用Monospace
。
- testString: 'assert(!$("p").css("font-family").match(/monospace/i), "Your paragraph elements should no longer use the font Monospace
.");'
+ testString: assert(!$("p").css("font-family").match(/monospace/i));
- text: 从顶部图像中删除smaller-image
类。
- testString: 'assert(!$("img").hasClass("smaller-image"), "Remove the smaller-image
class from your top image.");'
+ testString: assert(!$("img").hasClass("smaller-image"));
- text: 将img-responsive
类添加到您的顶部图像。
- testString: 'assert($(".img-responsive").length > 1, "Add the img-responsive
class to your top image.");'
+ testString: assert($(".img-responsive").length > 1);
```
diff --git a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/give-each-element-a-unique-id.chinese.md b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/give-each-element-a-unique-id.chinese.md
index b71a0f639c..b6e252e503 100644
--- a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/give-each-element-a-unique-id.chinese.md
+++ b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/give-each-element-a-unique-id.chinese.md
@@ -19,17 +19,17 @@ localeTitle: 为每个元素赋予唯一ID
```yml
tests:
- text: 一个button
元素应该具有id target1
。
- testString: 'assert($("#left-well").children("#target1") && $("#left-well").children("#target1").length > 0, "One button
element should have the id target1
.");'
+ testString: assert($("#left-well").children("#target1") && $("#left-well").children("#target1").length > 0);
- text: 一个button
元素应该具有id target2
。
- testString: 'assert($("#left-well").children("#target2") && $("#left-well").children("#target2").length > 0, "One button
element should have the id target2
.");'
+ testString: assert($("#left-well").children("#target2") && $("#left-well").children("#target2").length > 0);
- text: 一个button
元素应该具有id target3
。
- testString: 'assert($("#left-well").children("#target3") && $("#left-well").children("#target3").length > 0, "One button
element should have the id target3
.");'
+ testString: assert($("#left-well").children("#target3") && $("#left-well").children("#target3").length > 0);
- text: 一个button
元素应该具有id target4
。
- testString: 'assert($("#right-well").children("#target4") && $("#right-well").children("#target4").length > 0, "One button
element should have the id target4
.");'
+ testString: assert($("#right-well").children("#target4") && $("#right-well").children("#target4").length > 0);
- text: 一个button
元素应该具有id target5
。
- testString: 'assert($("#right-well").children("#target5") && $("#right-well").children("#target5").length > 0, "One button
element should have the id target5
.");'
+ testString: assert($("#right-well").children("#target5") && $("#right-well").children("#target5").length > 0);
- text: 一个button
元素应该具有id target6
。
- testString: 'assert($("#right-well").children("#target6") && $("#right-well").children("#target6").length > 0, "One button
element should have the id target6
.");'
+ testString: assert($("#right-well").children("#target6") && $("#right-well").children("#target6").length > 0);
```
diff --git a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/house-our-page-within-a-bootstrap-container-fluid-div.chinese.md b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/house-our-page-within-a-bootstrap-container-fluid-div.chinese.md
index beaa706e80..49790ffc4b 100644
--- a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/house-our-page-within-a-bootstrap-container-fluid-div.chinese.md
+++ b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/house-our-page-within-a-bootstrap-container-fluid-div.chinese.md
@@ -19,11 +19,11 @@ localeTitle: 将我们的页面放在Bootstrap容器 - 流体div中
```yml
tests:
- text: 你的div
元素应该有class container-fluid
。
- testString: 'assert($("div").hasClass("container-fluid"), "Your div
element should have the class container-fluid
.");'
+ testString: assert($("div").hasClass("container-fluid"));
- text: 确保每个div
元素都有一个结束标记。
- testString: 'assert(code.match(/<\/div>/g) && code.match(/div
元素中。
- testString: 'assert($("div").children("h3").length >0, "Nest your h3
element inside a div
element.");'
+ testString: assert($("div").children("h3").length >0);
```
diff --git a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/label-bootstrap-buttons.chinese.md b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/label-bootstrap-buttons.chinese.md
index 7baeaef511..642e164b4a 100644
--- a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/label-bootstrap-buttons.chinese.md
+++ b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/label-bootstrap-buttons.chinese.md
@@ -19,17 +19,17 @@ localeTitle: 标签引导按钮
```yml
tests:
- text: '给你的button
元素id为target1
文本#target1
。'
- testString: 'assert(new RegExp("#target1","gi").test($("#target1").text()), "Give your button
element with the id target1
the text #target1
.");'
+ testString: assert(new RegExp("#target1","gi").test($("#target1").text()));
- text: '给你的button
元素id为target2
文本#target2
。'
- testString: 'assert(new RegExp("#target2","gi").test($("#target2").text()), "Give your button
element with the id target2
the text #target2
.");'
+ testString: assert(new RegExp("#target2","gi").test($("#target2").text()));
- text: '给你的button
元素id为target3
文本#target3
。'
- testString: 'assert(new RegExp("#target3","gi").test($("#target3").text()), "Give your button
element with the id target3
the text #target3
.");'
+ testString: assert(new RegExp("#target3","gi").test($("#target3").text()));
- text: '给你的button
元素id为target4
文本#target4
。'
- testString: 'assert(new RegExp("#target4","gi").test($("#target4").text()), "Give your button
element with the id target4
the text #target4
.");'
+ testString: assert(new RegExp("#target4","gi").test($("#target4").text()));
- text: '给你的button
元素id为target5
文本#target5
。'
- testString: 'assert(new RegExp("#target5","gi").test($("#target5").text()), "Give your button
element with the id target5
the text #target5
.");'
+ testString: assert(new RegExp("#target5","gi").test($("#target5").text()));
- text: '使用id target6
为您的button
元素提供文本#target6
。'
- testString: 'assert(new RegExp("#target6","gi").test($("#target6").text()), "Give your button
element with the id target6
the text #target6
.");'
+ testString: assert(new RegExp("#target6","gi").test($("#target6").text()));
```
diff --git a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/label-bootstrap-wells.chinese.md b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/label-bootstrap-wells.chinese.md
index da5b6cc34c..b067931497 100644
--- a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/label-bootstrap-wells.chinese.md
+++ b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/label-bootstrap-wells.chinese.md
@@ -19,13 +19,13 @@ localeTitle: 标签Bootstrap Wells
```yml
tests:
- text: 在每个<div class="col-xs-6">
元素中添加一个h4
元素。
- testString: 'assert($(".col-xs-6").children("h4") && $(".col-xs-6").children("h4").length > 1, "Add an h4
element to each of your <div class="col-xs-6">
elements.");'
+ testString: assert($(".col-xs-6").children("h4") && $(".col-xs-6").children("h4").length > 1);
- text: '一个h4
元素应该有#left-well
文本。'
- testString: 'assert(new RegExp("#left-well","gi").test($("h4").text()), "One h4
element should have the text #left-well
.");'
+ testString: assert(new RegExp("#left-well","gi").test($("h4").text()));
- text: '一个h4
元素应该有#right-well
文本。'
- testString: 'assert(new RegExp("#right-well","gi").test($("h4").text()), "One h4
element should have the text #right-well
.");'
+ testString: assert(new RegExp("#right-well","gi").test($("h4").text()));
- text: 确保所有h4
元素都有结束标记。
- testString: 'assert(code.match(/<\/h4>/g) && code.match(//g).length === code.match(/
h4 elements have closing tags.");'
+ testString: assert(code.match(/<\/h4>/g) && code.match(/
/g).length === code.match(/
row的div中。
- testString: 'assert($("div.row:has(input[type=\"text\"])").length > 0 && $("div.row:has(button[type=\"submit\"])").length > 0, "Nest your form submission button and text input in a div with class
row
.");'
+ testString: assert($("div.row:has(input[type=\"text\"])").length > 0 && $("div.row:has(button[type=\"submit\"])").length > 0);
- text: 将表单文本输入嵌套在具有类col-xs-7
的div中。
- testString: 'assert($("div.col-xs-7:has(input[type=\"text\"])").length > 0, "Nest your form text input in a div with the class col-xs-7
.");'
+ testString: assert($("div.col-xs-7:has(input[type=\"text\"])").length > 0);
- text: 将表单提交按钮嵌套在具有类col-xs-5
的div中。
- testString: 'assert($("div.col-xs-5:has(button[type=\"submit\"])").length > 0, "Nest your form submission button in a div with the class col-xs-5
.");'
+ testString: assert($("div.col-xs-5:has(button[type=\"submit\"])").length > 0);
- text: 确保每个div
元素都有一个结束标记。
- testString: 'assert(code.match(/<\/div>/g) && code.match(/img-responsive
.");'
+ testString: assert($("img:eq(1)").hasClass("img-responsive"));
- text: 您的新图片不应该具有smaller-image
类。
- testString: 'assert(!$("img:eq(1)").hasClass("smaller-image"), "Your new image should not have the class smaller-image
.");'
+ testString: assert(!$("img:eq(1)").hasClass("smaller-image"));
- text: '您的新图片应该具有https://bit.ly/fcc-running-cats
的src
。'
- testString: 'assert($("img:eq(1)").attr("src") === "https://bit.ly/fcc-running-cats", "Your new image should have a src
of https://bit.ly/fcc-running-cats
.");'
+ testString: assert($("img:eq(1)").attr("src") === "https://bit.ly/fcc-running-cats");
- text: 确保新的img
元素具有关闭角括号。
- testString: 'assert(code.match(//g).length === 2 && code.match(/
img element has a closing angle bracket.");'
+ testString: assert(code.match(/
/g).length === 2 && code.match(/
div带有类
row
div
。
- testString: 'assert($("div.row:has(input[type=\"checkbox\"])").length > 0, "Nest all of your checkboxes inside one div
with the class row
.");'
+ testString: assert($("div.row:has(input[type=\"checkbox\"])").length > 0);
- text: 使用类col-xs-4
将每个复选框嵌入其自己的div
。
- testString: 'assert($("div.col-xs-4:has(input[type=\"checkbox\"])").length > 2, "Nest each of your checkboxes inside its own div
with the class col-xs-4
.");'
+ testString: assert($("div.col-xs-4:has(input[type=\"checkbox\"])").length > 2);
- text: 确保每个div
元素都有一个结束标记。
- testString: 'assert(code.match(/<\/div>/g) && code.match(/row
一个div
。
- testString: 'assert($("div.row:has(input[type=\"radio\"])").length > 0, "Nest all of your radio buttons inside one div
with the class row
.");'
+ testString: assert($("div.row:has(input[type=\"radio\"])").length > 0);
- text: 使用类col-xs-6
将每个单选按钮嵌套在自己的div
。
- testString: 'assert($("div.col-xs-6:has(input[type=\"radio\"])").length > 1, "Nest each of your radio buttons inside its own div
with the class col-xs-6
.");'
+ testString: assert($("div.col-xs-6:has(input[type=\"radio\"])").length > 1);
- text: 确保每个div
元素都有一个结束标记。
- testString: 'assert(code.match(/<\/div>/g) && code.match(/div class="col-xs-6"
元素。
- testString: 'assert($("div.row > div.col-xs-6").length > 1, "Nest two div class="col-xs-6"
elements within your div class="row"
element.");'
+ testString: assert($("div.row > div.col-xs-6").length > 1);
- text: 确保所有div
元素都有结束标记。
- testString: 'assert(code.match(/<\/div>/g) && code.match(/btn btn-primary
.");'
+ testString: assert($("button[type=\"submit\"]").hasClass("btn btn-primary"));
- text: 在提交button
元素中添加<i class="fa fa-paper-plane"></i>
。
- testString: 'assert($("button[type=\"submit\"]:has(i.fa.fa-paper-plane)").length > 0, "Add a <i class="fa fa-paper-plane"></i>
within your submit button
element.");'
+ testString: assert($("button[type=\"submit\"]:has(i.fa.fa-paper-plane)").length > 0);
- text: 在表单中input
文本input
类form-control
。
- testString: 'assert($("input[type=\"text\"]").hasClass("form-control"), "Give the text input
in your form the class form-control
.");'
+ testString: assert($("input[type=\"text\"]").hasClass("form-control"));
- text: 确保每个i
元素都有一个结束标记。
- testString: 'assert(code.match(/<\/i>/g) && code.match(/<\/i/g).length > 3, "Make sure each of your i
elements has a closing tag.");'
+ testString: assert(code.match(/<\/i>/g) && code.match(/<\/i/g).length > 3);
```
diff --git a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/taste-the-bootstrap-button-color-rainbow.chinese.md b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/taste-the-bootstrap-button-color-rainbow.chinese.md
index 882861d70e..28105eae5a 100644
--- a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/taste-the-bootstrap-button-color-rainbow.chinese.md
+++ b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/taste-the-bootstrap-button-color-rainbow.chinese.md
@@ -19,11 +19,11 @@ localeTitle: 品尝Bootstrap按钮彩虹
```yml
tests:
- text: 你的按钮应该有btn-primary
类。
- testString: 'assert($("button").hasClass("btn-primary"), "Your button should have the class btn-primary
.");'
+ testString: assert($("button").hasClass("btn-primary"));
- text: 你的按钮应该仍然有btn
和btn-block
类。
- testString: 'assert($("button").hasClass("btn-block") && $("button").hasClass("btn"), "Your button should still have the btn
and btn-block
classes.");'
+ testString: assert($("button").hasClass("btn-block") && $("button").hasClass("btn"));
- text: 确保所有button
元素都有一个结束标记。
- testString: 'assert(code.match(/<\/button>/g) && code.match(/p
元素中。
- testString: 'assert($("p span") && $("p span").length > 0, "Your span
element should be inside your p
element.");'
+ testString: assert($("p span") && $("p span").length > 0);
- text: 你的span
元素应该只有文字love
。
- testString: 'assert($("p span") && $("p span").text().match(/love/i) && !$("p span").text().match(/Things cats/i), "Your span
element should have just the text love
.");'
+ testString: assert($("p span") && $("p span").text().match(/love/i) && !$("p span").text().match(/Things cats/i));
- text: 你的span
元素应该有class text-danger
。
- testString: 'assert($("span").hasClass("text-danger"), "Your span
element should have class text-danger
.");'
+ testString: assert($("span").hasClass("text-danger"));
- text: 确保您的span
元素具有结束标记。
- testString: 'assert(code.match(/<\/span>/g) && code.match(//g).length === code.match(/span element has a closing tag.");'
+ testString: assert(code.match(/<\/span>/g) && code.match(//g).length === code.match(/<!--开始评论。
- testString: 'assert(code.match(/^\s*.*this line))\s*.*this line.*\s*-->/gi), "Your comment should have the text Only change code above this line
.");'
+ testString: assert(code.match(/.*this line))\s*.*this line.*\s*-->/gi));
- text: 请务必使用-->
关闭您的评论。
- testString: 'assert(code.match(/-->.*\n+.+/g), "Be sure to close your comment with -->
.");'
+ testString: assert(code.match(/-->.*\n+.+/g));
- text: 你应该有相同数量的评论开启者和关闭者。
- testString: 'assert(code.match(//g).length, "You should have the same number of comment openers and closers.");'
+ testString: assert(code.match(//g).length);
```
diff --git a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/use-responsive-design-with-bootstrap-fluid-containers.chinese.md b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/use-responsive-design-with-bootstrap-fluid-containers.chinese.md
index 2b5d03fe71..b6ca4084d8 100644
--- a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/use-responsive-design-with-bootstrap-fluid-containers.chinese.md
+++ b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/use-responsive-design-with-bootstrap-fluid-containers.chinese.md
@@ -19,11 +19,11 @@ localeTitle: 使用具有Bootstrap Fluid Containers的响应式设计
```yml
tests:
- text: 你的div
元素应该有class container-fluid
。
- testString: 'assert($("div").hasClass("container-fluid"), "Your div
element should have the class container-fluid
.");'
+ testString: assert($("div").hasClass("container-fluid"));
- text: 确保你的div
元素有一个结束标记。
- testString: 'assert(code.match(/<\/div>/g) && code.match(/style
标记之后嵌套了所有HTML元素。
- testString: 'assert($(".container-fluid").children().length >= 8, "Make sure you have nested all HTML elements after the closing style
tag in .container-fluid
.");'
+ testString: assert($(".container-fluid").children().length >= 8);
```
diff --git a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/use-the-bootstrap-grid-to-put-elements-side-by-side.chinese.md b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/use-the-bootstrap-grid-to-put-elements-side-by-side.chinese.md
index 564ebd82ff..7d84c27feb 100644
--- a/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/use-the-bootstrap-grid-to-put-elements-side-by-side.chinese.md
+++ b/curriculum/challenges/chinese/03-front-end-libraries/bootstrap/use-the-bootstrap-grid-to-put-elements-side-by-side.chinese.md
@@ -19,13 +19,13 @@ localeTitle: 使用Bootstrap网格并排放置元素
```yml
tests:
- text: 您的按钮应全部嵌套在具有类row
的同一div
元素中。
- testString: 'assert($("div.row:has(button)").length > 0, "Your buttons should all be nested within the same div
element with the class row
.");'
+ testString: assert($("div.row:has(button)").length > 0);
- text: 每个Bootstrap按钮都应嵌套在自己的div
元素中,类别为col-xs-4
。
- testString: 'assert($("div.col-xs-4:has(button)").length > 2, "Each of your Bootstrap buttons should be nested within its own div
element with the class col-xs-4
.");'
+ testString: assert($("div.col-xs-4:has(button)").length > 2);
- text: 确保每个button
元素都有一个结束标记。
- testString: 'assert(code.match(/<\/button>/g) && code.match(/button
element with the text "Delete".");'
+ testString: assert(new RegExp("Delete","gi").test($("button").text()));
- text: 你的所有Bootstrap按钮都应该有btn
和btn-block
类。
- testString: 'assert($("button.btn-block.btn").length > 2, "All of your Bootstrap buttons should have the btn
and btn-block
classes.");'
+ testString: assert($("button.btn-block.btn").length > 2);
- text: 你的新按钮应该有类btn-danger
。
- testString: 'assert($("button").hasClass("btn-danger"), "Your new button should have the class btn-danger
.");'
+ testString: assert($("button").hasClass("btn-danger"));
- text: 确保所有button
元素都有一个结束标记。
- testString: 'assert(code.match(/<\/button>/g) && code.match(/target4
button by adding HTML tags.");'
+ testString: assert.isTrue((/|\s*#target4\s*<\/em>|<\/i>/gi).test($("#target4").html()));
- text: 确保文本不变。
- testString: 'assert($("#target4") && $("#target4").text().trim() === "#target4", "Make sure the text is otherwise unchanged.");'
+ testString: assert($("#target4") && $("#target4").text().trim() === '#target4');
- text: 不要改变任何其他文字。
- testString: 'assert.isFalse((/|/gi).test($("h3").html()), "Do not alter any other text.");'
+ testString: assert.isFalse((/|/gi).test($("h3").html()));
- text: 确保使用.html()
而不是.text()
。
- testString: 'assert(code.match(/\.html\(/g), "Make sure you are using .html()
and not .text()
.");'
+ testString: assert(code.match(/\.html\(/g));
- text: 确保使用jQuery选择button id="target4"
。
- testString: 'assert(code.match(/\$\(\s*?(\"|\")#target4(\"|\")\s*?\)\.html\(/), "Make sure to select button id="target4"
with jQuery.");'
+ testString: assert(code.match(/\$\(\s*?(\"|\')#target4(\"|\')\s*?\)\.html\(/));
```
diff --git a/curriculum/challenges/chinese/03-front-end-libraries/jquery/change-the-css-of-an-element-using-jquery.chinese.md b/curriculum/challenges/chinese/03-front-end-libraries/jquery/change-the-css-of-an-element-using-jquery.chinese.md
index 5001de3449..b9850281ab 100644
--- a/curriculum/challenges/chinese/03-front-end-libraries/jquery/change-the-css-of-an-element-using-jquery.chinese.md
+++ b/curriculum/challenges/chinese/03-front-end-libraries/jquery/change-the-css-of-an-element-using-jquery.chinese.md
@@ -21,9 +21,9 @@ localeTitle: 使用jQuery更改元素的CSS
```yml
tests:
- text: 您的target1
元素应该有红色文本。
- testString: 'assert($("#target1").css("color") === "rgb(255, 0, 0)", "Your target1
element should have red text.");'
+ testString: assert($("#target1").css("color") === 'rgb(255, 0, 0)');
- text: 只使用jQuery将这些类添加到元素中。
- testString: 'assert(!code.match(/class.*animated/g), "Only use jQuery to add these classes to the element.");'
+ testString: assert(!code.match(/class.*animated/g));
```
diff --git a/curriculum/challenges/chinese/03-front-end-libraries/jquery/clone-an-element-using-jquery.chinese.md b/curriculum/challenges/chinese/03-front-end-libraries/jquery/clone-an-element-using-jquery.chinese.md
index 80e525f8ae..50f6392993 100644
--- a/curriculum/challenges/chinese/03-front-end-libraries/jquery/clone-an-element-using-jquery.chinese.md
+++ b/curriculum/challenges/chinese/03-front-end-libraries/jquery/clone-an-element-using-jquery.chinese.md
@@ -19,11 +19,11 @@ localeTitle: 使用jQuery克隆元素
```yml
tests:
- text: 你的target5
元素应该在你的right-well
。
- testString: 'assert($("#right-well").children("#target5").length > 0, "Your target5
element should be inside your right-well
.");'
+ testString: assert($("#right-well").children("#target5").length > 0);
- text: 您的target5
元素的副本也应该在您的left-well
。
- testString: 'assert($("#left-well").children("#target5").length > 0, "A copy of your target5
element should also be inside your left-well
.");'
+ testString: assert($("#left-well").children("#target5").length > 0);
- text: 只使用jQuery来移动这些元素。
- testString: 'assert(!code.match(/class.*animated/g), "Only use jQuery to move these elements.");'
+ testString: assert(!code.match(/class.*animated/g));
```
diff --git a/curriculum/challenges/chinese/03-front-end-libraries/jquery/delete-your-jquery-functions.chinese.md b/curriculum/challenges/chinese/03-front-end-libraries/jquery/delete-your-jquery-functions.chinese.md
index 2c8f6aa378..375740134b 100644
--- a/curriculum/challenges/chinese/03-front-end-libraries/jquery/delete-your-jquery-functions.chinese.md
+++ b/curriculum/challenges/chinese/03-front-end-libraries/jquery/delete-your-jquery-functions.chinese.md
@@ -21,15 +21,15 @@ localeTitle: 删除您的jQuery函数
```yml
tests:
- text: 从document ready function
删除所有三个jQuery document ready function
。
- testString: 'assert(code.match(/\{\s*\}\);/g), "Delete all three of your jQuery functions from your document ready function
.");'
+ testString: assert(code.match(/\{\s*\}\);/g));
- text: 保持script
元素不变。
- testString: 'assert(code.match(/