Created
April 6, 2011 13:30
-
-
Save tfluehr/905635 to your computer and use it in GitHub Desktop.
Array method for fast string addition.
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
Array.prototype.pushReplace = function(pattern){ | |
var args = $A(arguments).slice(1); | |
this.push(pattern.replace(/\{(\d+)\}/g, function(pattern, index){ | |
return args[index].toString(); | |
})); | |
return this; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment