Files

40 lines
783 B
Markdown
Raw Normal View History

2018-10-12 15:37:13 -04:00
---
title: Write Arrow Functions with Parameters
---
# Write Arrow Functions with Parameters
2018-10-12 15:37:13 -04:00
---
## Problem Explanation
2018-10-12 15:37:13 -04:00
Here is a [cool resource about anonymous functions in JavaScript](http://helephant.com/2008/08/23/javascript-anonymous-functions/), in case you are still wondering what they are, and their role.
Now, you are tasked at putting parameters inside arrow functions.
---
## Hints
### Hint 1
2018-10-12 15:37:13 -04:00
Get rid of the `function` keyword. Put the arrow operator.
### Hint 2
2018-10-12 15:37:13 -04:00
Make sure you changed the `var` to a `const`.
---
## Solutions
<details><summary>Solution 1 (Click to Show/Hide)</summary>
2018-10-12 15:37:13 -04:00
```javascript
const myConcat = (arr1, arr2) => {
"use strict";
return arr1.concat(arr2);
};
// test your code
console.log(myConcat([1, 2], [3, 4, 5]));
```
</details>