2018-10-10 18:03:03 -04:00
---
id: 587d7b88367417b2b2512b44
title: Write Arrow Functions with Parameters
challengeType: 1
2019-08-28 16:26:13 +03:00
forumTopicId: 301223
2018-10-10 18:03:03 -04:00
localeTitle: Функции записи стрелки с параметрами
---
## Description
2019-08-28 16:26:13 +03:00
< section id = 'description' >
Подобно нормальной функции, вы можете передавать аргументы в функции стрелок. < blockquote > // удваивает входное значение и возвращает е г о < br > const doubler = (item) => item * 2; < / blockquote > Вы можете передать более одного аргумента в функции стрелок.
< / section >
2018-10-10 18:03:03 -04:00
## Instructions
2019-08-28 16:26:13 +03:00
< section id = 'instructions' >
Перепишите функцию < code > myConcat< / code > которая добавляет содержимое < code > arr2< / code > в < code > arr1< / code > чтобы функция использовала синтаксис функции стрелки.
< / section >
2018-10-10 18:03:03 -04:00
## Tests
< section id = 'tests' >
```yml
tests:
2019-08-28 16:26:13 +03:00
- text: User did replace < code > var</ code > keyword.
testString: getUserInput => assert(!getUserInput('index').match(/var/g));
- text: < code > myConcat</ code > should be a constant variable (by using < code > const</ code > ).
testString: getUserInput => assert(getUserInput('index').match(/const\s+myConcat/g));
- text: < code > myConcat</ code > should be a function
testString: assert(typeof myConcat === 'function');
- text: < code > myConcat()</ code > returns the correct < code > array</ code >
testString: assert(() => { const a = myConcat([1], [2]); return a[0] == 1 & & a[1] == 2; });
- text: < code > function</ code > keyword was not used.
testString: getUserInput => assert(!getUserInput('index').match(/function/g));
2018-10-10 18:03:03 -04:00
```
< / section >
## Challenge Seed
< section id = 'challengeSeed' >
< div id = 'js-seed' >
```js
var myConcat = function(arr1, arr2) {
"use strict";
return arr1.concat(arr2);
};
// test your code
console.log(myConcat([1, 2], [3, 4, 5]));
```
< / div >
< / section >
## Solution
< section id = 'solution' >
```js
2019-08-28 16:26:13 +03:00
const myConcat = (arr1, arr2) => {
"use strict";
return arr1.concat(arr2);
};
// test your code
console.log(myConcat([1, 2], [3, 4, 5]));
2018-10-10 18:03:03 -04:00
```
2019-08-28 16:26:13 +03:00
2018-10-10 18:03:03 -04:00
< / section >