Skip to content

Instantly share code, notes, and snippets.

@okabe-yuya

okabe-yuya/range.js

Created Oct 29, 2020
Embed
What would you like to do?
これBIFで用意しておいてほしい
const range = (a, z) => _range(a, z, [])
const _range = (a, z, acc) => a < z + 1 ? _range(a+1, z, acc.concat(a)) : acc
const print = (v) => console.log("[info]", v)
print(range(1, 10)) // [info] [1, 2, .... 10]
print(range(1, 100)) // [info] [1, 2, .... 100]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment