JavaScriptEasy
What are template literals and how are they used?
By FrontendPro Editorial Team Updated 8/8/2026
#JavaScript
Answer
Template literals are a feature in JavaScript that allow for easier string interpolation and multi-line strings. They are enclosed by backticks (`) instead of single or double quotes. You can embed expressions within template literals using ${expression} syntax.
Example:
js
const myName = "John";
const greeting = `Hello, ${myName}!`;
console.log(greeting); // Output: Hello, John!
