Skip to content

Instantly share code, notes, and snippets.

@loickreitmann
Created May 8, 2012 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loickreitmann/2639138 to your computer and use it in GitHub Desktop.
Save loickreitmann/2639138 to your computer and use it in GitHub Desktop.
String.times: String method to repeat a string n times
String.prototype.times = function( n ) {
return Array.prototype.join.call( { length : n + 1 }, this );
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment