1

I am trying to make a function range that takes in start and end as parameters. I want it to give me a range of all numbers from the parameter start till end(inclusive).

function range(start, end) {
  array = []; 
  for(var i = start; start <= end; i++) {
    array.push(i);
  }
  return array;
}

console.log(range(1, 10));
// → [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
thefourtheye
  • 233,700
  • 52
  • 457
  • 497
wwang8421
  • 57
  • 2

0 Answers0