String.prototype.format = function() { var arg = arguments; return this.replace(/\{(\d+)\}/g, function(a,b){ return arg[b] }); } first_arg = 'power' second_arg = 'mojo' formated_str = 'some {0} {1}'.format(first_arg, second_arg)