Skip to content

Instantly share code, notes, and snippets.

@morbidcamel101
Created August 4, 2015 22:45
Show Gist options
  • Select an option

  • Save morbidcamel101/399332f26e92c101f1f1 to your computer and use it in GitHub Desktop.

Select an option

Save morbidcamel101/399332f26e92c101f1f1 to your computer and use it in GitHub Desktop.
if (!String.prototype.format) {
String.prototype.format = function() {
var args = arguments;
return this.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
});
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment