--- id: 587d7b88367417b2b2512b44 title: Write Arrow Functions with Parameters challengeType: 1 videoUrl: '' localeTitle: 用参数写箭头函数 --- ## Description
就像普通函数一样,您可以将参数传递给箭头函数。
//将输入值加倍并返回
const doubler =(item)=> item * 2;
您也可以将多个参数传递给箭头函数。
## Instructions
重写myConcat函数,该函数将arr2内容追加到arr1以便该函数使用箭头函数语法。
## Tests
```yml tests: - text: 用户确实替换了var关键字。 testString: 'getUserInput => assert(!getUserInput("index").match(/var/g), "User did replace var keyword.");' - text: myConcat应该是一个常量变量(使用const )。 testString: 'getUserInput => assert(getUserInput("index").match(/const\s+myConcat/g), "myConcat should be a constant variable (by using const).");' - text: myConcat应该是一个函数 testString: 'assert(typeof myConcat === "function", "myConcat should be a function");' - text: myConcat()返回正确的array testString: 'assert(() => { const a = myConcat([1], [2]); return a[0] == 1 && a[1] == 2; }, "myConcat() returns the correct array");' - text: function关键字未使用。 testString: 'getUserInput => assert(!getUserInput("index").match(/function/g), "function keyword was not used.");' ```
## Challenge Seed
```js var myConcat = function(arr1, arr2) { "use strict"; return arr1.concat(arr2); }; // test your code console.log(myConcat([1, 2], [3, 4, 5])); ```
## Solution
```js // solution required ```