Skip to content

Instantly share code, notes, and snippets.

@jimfleming
Created August 25, 2010 15:47
Show Gist options
  • Save jimfleming/549750 to your computer and use it in GitHub Desktop.
Save jimfleming/549750 to your computer and use it in GitHub Desktop.
repeats a given string x times (source: stackoverflow)
String.prototype.repeat = function(times) {
return new Array(isNaN(times) ? 1 : ++times).join(this);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment