Skip to content

Instantly share code, notes, and snippets.

@eloycoto
Created May 7, 2014 08:30
Show Gist options
  • Save eloycoto/24f8e584e4b02e8a8ac3 to your computer and use it in GitHub Desktop.
Save eloycoto/24f8e584e4b02e8a8ac3 to your computer and use it in GitHub Desktop.
String.prototype.format = function () {
var i = 0, args = arguments;
return this.replace(/{}/g, function () {
return typeof args[i] != 'undefined' ? args[i++] : '';
});
};
'Key: {} value: {}'.format('test',true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment