O'Reilly logo

Hands-On Microservices with Node.js by Diogo Resende

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Template literals

Template literals are string literals that allow embedded expressions. Another advantage of these literals is that they can be written in multiple lines:

function hello(name) {    console.log(`Hello ${name}`);}

It's not a simple variable substitution, since it evaluates expressions of any kind:

function hello(name, age) {    console.log(`hi ${name}, you were born in ${(new Date).getFullYear() - age}`);}

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required