Last active
August 29, 2015 14:21
-
-
Save joshblack/db2fd8d3197e76f60ef9 to your computer and use it in GitHub Desktop.
Creates an array of a given amount and fills it with the given item
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 fill(amount, item) { | |
| const a = Array(amount), | |
| i = j = 0; | |
| for (i; i < amount; i++) { | |
| a[j++] = item; | |
| } | |
| return a; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment