Skip to content

Instantly share code, notes, and snippets.

@mbchoa
Last active April 4, 2021 19:32
Show Gist options
  • Save mbchoa/7aee34893f3acea2cfb64735835bd4e0 to your computer and use it in GitHub Desktop.
Save mbchoa/7aee34893f3acea2cfb64735835bd4e0 to your computer and use it in GitHub Desktop.
Creates an array of specified size containing copies of element provided.
function fill(el, numRepeat) {
return [...Array(numRepeat)].map(() => el).join('');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment