Last active
October 31, 2017 20:18
-
-
Save KimSarabia/7e54f0858506b211822d855d2411ba6d to your computer and use it in GitHub Desktop.
Print Range in JavaScript (ES6)
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
//Print 1 to 20 (Source: https://stackoverflow.com/questions/3895478/does-javascript-have-a-method-like-range-to-generate-an-array-based-on-suppl) | |
Array.from(new Array(20), (x,i) => i) | |
//Result: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment