DEV Community

Raneem Adba
Raneem Adba

Posted on

How to create a simple range function in JS?

**

Functions in JavaScript:

**
The range function:
Write a range function that takes three arguments, start,end and step. And returns an array containing all the numbers from start up including the end.
--With the step argument:
If no step is given, the elements go up by increments of one, corresponding to the old behavior. The function call range(1, 10, 2) should return [1, 3, 5, 7, 9].

Image description

Top comments (0)