Is there a C# String.Format() equivalent in JavaScript? -
this question has answer here: equivalent of string.format in jquery 19 answers c# has powerful string.format() replacing elements {0} with parameters. javascript have equivalent? try sprintf() javascript . or // first, checks if isn't implemented yet. 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 ; }); }; } "{0} dead, {1} alive! {0} {2}".format("asp", "asp.net") both answers pulled javascript equivalent printf/string.format