* fix: Chinese test suite Add localeTiltes, descriptions, and adjust test text and testStrings to get the automated test suite working. * fix: ran script, updated testStrings and solutions
2.1 KiB
2.1 KiB
id, title, challengeType, videoUrl, localeTitle
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
587d7b7b367417b2b2512b17 | Combine Arrays with the Spread Operator | 1 | 将数组与Spread运算符组合在一起 |
Description
让thisArray = ['sage','迷迭香','欧芹','百里香'];使用扩展语法,我们刚刚实现了一个操作,如果我们使用传统方法,这个操作会更复杂,更冗长。
让那个阵容= ['罗勒','香菜',......这个阿雷,'香菜'];
//现在等于['罗勒','香菜','鼠尾草','迷迭香','欧芹','百里香','香菜']
Instructions
spreadOut
,它返回变量sentence
,使用spread运算符修改函数,使它返回数组['learning', 'to', 'code', 'is', 'fun']
。 Tests
tests:
- text: '<code>spreadOut</code>应该返回<code>["learning", "to", "code", "is", "fun"]</code>'
testString: assert.deepEqual(spreadOut(), ['learning', 'to', 'code', 'is', 'fun']);
- text: <code>spreadOut</code>函数应该使用扩展语法
testString: assert.notStrictEqual(spreadOut.toString().search(/[...]/), -1);
Challenge Seed
function spreadOut() {
let fragment = ['to', 'code'];
let sentence; // change this line
return sentence;
}
// do not change code below this line
console.log(spreadOut());
Solution
// solution required