Created
May 8, 2012 20:46
-
-
Save loickreitmann/2639138 to your computer and use it in GitHub Desktop.
String.times: String method to repeat a string n times
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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