0

Is there something in node.js to format string like this:

format("HEY! my name is #{name} and I live at #{place}", {name: "joe", "place":"london"})
Biffen
  • 6,249
  • 6
  • 28
  • 36
Nikhil Ranjan
  • 994
  • 12
  • 16
  • possible duplicate of [JavaScript equivalent to printf/string.format](http://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format) – Paul Sasik Jun 29 '14 at 09:13
  • This has been asked many times, many different ways. The answer is always: no, there's nothing built in but there are tons of libs for you to choose from: https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=javascript+sprintf&safe=active – Paul Sasik Jun 29 '14 at 09:15

1 Answers1

0

Not directly, but if you use CoffeeScript you can use that syntax:

name = "joe"
place = "london"

console.log("HEY! my name is #{name} and i live at #{place}")
7zark7
  • 10,015
  • 5
  • 39
  • 54