As far as I know there is no string.format in javascript but you could actually add that function to your string variable and that might have confused you as described here
http://frogsbrain.blogspot.com/2007/04/javascript-stringformat-method.html
But, otherwise you could take that approach to format or use regular expressions as suggested here as well
http://www.geekdaily.net/2007/06/21/cs-stringformat-for-javascript/