Skip to content

Exercise: range function

Daisho Komiyama edited this page Apr 20, 2018 · 5 revisions

Exercise

Write a range function that takes three arguments, start, end and skip, and returns an array containing all the numbers from start up to (and including) end, skipping the number at index indicated by skip.

Example:

range(2, 10);
// [2, 3, 4, 5, 6, 7, 8, 9, 10]
range(2, 10, 1);
// [2, 4, 5, 6, 7, 8, 9, 10]
// number 3 at index 1 is skipped
Clone this wiki locally