Explorer
Node.js

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); ```

Arrow Functions

Easy
Write an arrow function `double` that takes an array and returns a new array with each element doubled.
Editor
Loading Editor...
Evaluate code
Output:Click "Run" above to execute and verify your code here.
[[2,4,6],[10,20]]