javascript / beginner
Snippet
Template Literals
Template literals use backticks (`) instead of quotes. They allow for easy string interpolation using the ${variable} syntax, making code more readable than standard concatenation.
snippet.js
1
2
3
const user = 'Markus';const message = `Hello, ${user}!`;console.log(message);
nodejs
Breakdown
1
const user = 'Markus';
Declares a constant string variable.
2
const message = `Hello, ${user}!`;
Uses backticks and ${} to inject the variable directly into the string.