javascript / beginner
Snippet
Template Literals
Template literals (using backticks) allow you to embed variables directly into strings using the ${} syntax, making code much cleaner than using + for concatenation.
snippet.js
1
2
3
const name = 'Markus';const message = `Welcome back, ${name}!`;console.log(message);
nodejs
Breakdown
1
const message = `Welcome back, ${name}!`;
Uses backticks and ${} to insert the value of 'name' into the string.