Skip to content

Instantly share code, notes, and snippets.

@vlad-bezden
Last active August 29, 2015 14:17
Show Gist options
  • Save vlad-bezden/ccaaafff42dc82e2d956 to your computer and use it in GitHub Desktop.
Save vlad-bezden/ccaaafff42dc82e2d956 to your computer and use it in GitHub Desktop.
repeat string by number of times in JavaScript
String.prototype.times = function(count) {
return count < 1 ? '' : new Array(count + 1).join(this);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment