Created
July 20, 2021 18:49
-
-
Save n3ps/d672aed3635654f42f9343bdee02645f to your computer and use it in GitHub Desktop.
Array range
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function range (start, stop) { | |
| const len = stop - start + 1 | |
| return Array(len).fill().map((_, i) => start + 1) | |
| } | |
| // Usage | |
| range(10, 12) // [10, 11, 12] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment