Explorer
Node.js

Write a function `range(start, end)` that returns an array of numbers from start to end (inclusive).

Problem Statement

Write a function `range(start, end)` that returns an array of numbers from start to end (inclusive).

Complexity

Time Complexity: -

Space Complexity: -

Hints

šŸ’” Hint 1: Array.from() can create arrays from array-like objects. šŸ’” Hint 2: Array.from({ length: n }, (_, i) => ...) creates an array of n elements. šŸ’” Hint 3: Array.from({ length: end - start + 1 }, (_, i) => start + i); āœ… Solution: ```javascript function range(start, end) { return Array.from({ length: end - start + 1 }, (_, i) => start + i); } ```

Array.from and Range

Easy
Write a function `range(start, end)` that returns an array of numbers from start to end (inclusive).
Editor
Loading Editor...
Evaluate code
Output:Click "Run" above to execute and verify your code here.
[[1,2,3,4,5],[3,4,5,6,7]]