coffeescript Strings Placeholder replacements


Placeholders can be used in strings to automatically substitute the values in the final string.

container = "cup"
liquid = "coffee"
string = "Filling the #{container} with #{liquid}..."

The above String - when printed - will say: Filling the cup with coffee...

You can even use Coffee-script inside these placeholders

sentence = "#{ 22 / 7 } is a decent approximation of π"