Last Updated: February 25, 2016
·
3.399K
· fr0gs

Template literals in Coffeescript

While in ES2015/ES6 the way to access template literals is in the way:

var k = 'whatever'
console.log(`I just said ${k}`); 
//output: 'I just said whatever'

In CoffeeScript one must write the string between double quotes and change $ for a #.:

k = 'whatever'
console.log "I just said #{k}"
//output: 'I just said whatever'.

If written in single quotes, it will output:

//'I just said #{k}'

Directly.