Possible Duplicate:
JavaScript equivalent to printf/string.format
I'm using dictionary to hold all text used in the website like
var dict = {
"text1": "this is my text"
};
Calling texts with javascript(jQuery),
$("#firstp").html(dict.text1);
And come up with a problem that some of my text is not static. I need to write some parameter into my text.
You have 100 messages
$("#firstp").html(dict.sometext+ messagecount + dict.sometext);
and this is noobish
I want something like
var dict = {
"text1": "you have %s messages"
};
How can I write "messagecount" in to where %s is.