Write an arrow function `double` that takes an array and returns a new array with each element doubled.
Problem Statement
Write an arrow function `double` that takes an array and returns a new array with each element doubled.
Complexity
Time Complexity: -
Space Complexity: -
Hints
š” Hint 1:
Arrow functions: const fn = (x) => x * 2;
š” Hint 2:
Use Array.map() to transform each element.
š” Hint 3:
const double = (arr) => arr.map(x => x * 2);
ā
Solution:
```javascript
const double = (arr) => arr.map(x => x * 2);
```