Here you can find the source of format()
// String formatting function taken from http://stackoverflow.com/a/2648463 String.prototype.format = String.prototype.f = function() { var s = this,/*from w w w . j a va2 s .co m*/ i = arguments.length; while (i--) { s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), arguments[i]); } return s; };
Number.prototype.formatString = function(num, comma) { return this.toFixed(num).toString().replace(/\.([0-9]*)$/, comma+"$1");
String.prototype.format = String.prototype.f = function () { var s = this, i = arguments.length; while (i--) { s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), arguments[i]); return s; };
String.prototype.format = String.prototype.f = function () { var args = arguments; return this.replace(/\{\{|\}\}|\{(\d+)\}/g, function (m, n) { if (m == "{{") { return "{"; } if (m == "}}") { return "}"; } return args[n]; }); };
String.prototype.format = String.prototype.f = function () { var s = this, i = arguments.length; while (i--) { s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), arguments[i]); return s; };
String.prototype.format = String.prototype.f = function() { var s = this, i = arguments.length; while (i--) { s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), arguments[i]); return s; };
'use strict'; String.prototype.format = String.prototype.f = function() { var s = this, i = arguments.length; while (i--) { s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), arguments[i]); return s; }; ...
String.prototype.format = String.prototype.f = function(options) { options = options ? options : []; if (typeof options != "object") options = [options]; var s = this, i = options.length; while (i--) { s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), options[i]); return s; ...
String.prototype.format = String.prototype.format = function() { var s = this, i = arguments.length; while (i--) { s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), arguments[i]); return s; };
String.prototype.format = String.prototype.format || function () { var str = this.toString(); if (arguments.length) { var t = typeof arguments[0]; var key; var args = ("string" === t || "number" === t) ? Array.prototype.slice.call(arguments) : arguments[0]; ...