String.prototype.format = function() { var args = arguments; return this.replace(/{(\d+)}/g, function(match, number) { return typeof args[number] != 'undefined' ? args[number] : match ; }); }; 사용예) var sTemp = " num1 : {0}, num2 : {1}"; console.log(sTemp.format("12","25")); 결과) num1 : 12, num2 : 25