r/javascript • • Jan 28 '12

how come javascript doesn't have printf?

0 Upvotes

13 comments sorted by

View all comments

4

u/x-skeww Jan 28 '12 edited Jan 28 '12

The base library was made for doing stuff in a browser.

printf (and friends) are more for CLI things.

That's the best explanation I can offer.

https://github.com/epeli/underscore.string

http://www.diveintojavascript.com/projects/javascript-sprintf

Edit: If you want to use it for outputting markup, use templates instead (Mustache or Handlebars).