Guest User

Untitled

a guest
Aug 20th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. const inc = num => num + 1;
  2. const range = (start, end, coll = []) => {
  3. if (start > end) return coll;
  4. return range(inc(start), end, coll.concat(start));
  5. };
  6.  
  7. range(1, 5); // [1, 2, 3, 4, 5]
Add Comment
Please, Sign In to add comment