Skip to content

Instantly share code, notes, and snippets.

@tfluehr
Created April 6, 2011 13:30
Show Gist options
  • Save tfluehr/905635 to your computer and use it in GitHub Desktop.
Save tfluehr/905635 to your computer and use it in GitHub Desktop.
Array method for fast string addition.
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