Skip to content

Instantly share code, notes, and snippets.

@joshblack
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save joshblack/db2fd8d3197e76f60ef9 to your computer and use it in GitHub Desktop.

Select an option

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
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