Since ES6, you can use template literals:

const age = 3
console.log(`I'm ${age} years old!`)

P.S. Note the use of backticks: ``.

Answer from Damjan Pavlica on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Template_literals
Template literals (Template strings) - JavaScript | MDN
Dollar signs can be escaped as well to prevent interpolation. ... Any newline characters inserted in the source are part of the template literal. Using normal strings, you would have to use the following syntax in order to get multi-line strings:
🌐
W3Schools
w3schools.com › js › js_string_templates.asp
JavaScript String Templates
Template Strings allow interpolation of expressions in strings: let price = 10; let VAT = 0.25; let total = `Total: ${(price * (1 + VAT)).toFixed(2)}`; Try it Yourself » · let header = "Template Strings"; let tags = ["template strings", "javascript", "es6"]; let html = `<h2>${header}</h2><ul>`; for (const x of tags) { html += `<li>${x}</li>`; } html += `</ul>`; Try it Yourself » ·
🌐
W3docs
w3docs.com › javascript
How to Do String Interpolation in JavaScript
Replacement of placeholders with values inside of a string literal is called string interpolation. In JavaScript, the template literals (also template string) wrapped in backticks (`) that supports the string interpolation and ${expression} ...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › string-interpolation-in-javascript
String Interpolation in JavaScript - GeeksforGeeks
October 14, 2025 - You can use an array and the join() method to interpolate strings, though this is less common and more verbose. ... Hello, Alice! A custom function can be used to handle string interpolation, especially if the string structure is complex or repeated.
🌐
Mastering JS
masteringjs.io › tutorials › fundamentals › string-interpolation
JavaScript String Interpolation - Mastering JS
String interpolation means replacing placeholders in a string with computed values. Here's how you can do string interpolation in JavaScript using template literals.
🌐
TutorialsPoint
tutorialspoint.com › how-to-do-string-interpolation-in-javascript
How to do string interpolation in JavaScript?
String interpolation in JavaScript is a process in which an expression is inserted or placed in the string. To insert or embed this expression into the string a template literal is used. By using string interpolation in JavaScript, values like variab
🌐
Dmitri Pavlutin
dmitripavlutin.com › string-interpolation-in-javascript
String Interpolation in JavaScript
March 21, 2023 - The first, which I prefer for plain strings, is to wrap the string into a pair of single quotes ': ... The string literal wrapped in backticks ` is also named template string. This is the literal that supports the string interpolation.
Find elsewhere
🌐
freeCodeCamp
freecodecamp.org › news › javascript-string-format-how-to-use-string-interpolation-in-js
JavaScript String Format – How to use String Interpolation in JS
September 8, 2020 - You can see an example of string interpolation using template literals in the snippet below: const age = 4.5; const earthAge = `Earth is estimated to be ${age} billion years old.`; console.log(earthAge); First of all, you'll see that we are using backticks for template literals. Besides that, we also have the format of ${placeholder}, which allows us to insert a dynamic value into the string. Anything inside ${} is evaluated as JavaScript.
🌐
Flexiple
flexiple.com › javascript › javascript-string-interpolation
JavaScript String Interpolation - Flexiple
Explore JavaScript string interpolation with template literals for embedding expressions in strings, enhancing readability and efficiency in coding.
🌐
Medium
medium.com › @abhishekprasadkashyap › exploring-template-literals-javascripts-powerful-string-interpolation-5f62c1f04c0a
Exploring Template Literals: JavaScript’s Powerful String Interpolation | by Abhishek Prasad | Medium
October 3, 2024 - These expressions are automatically evaluated, and the result is inserted into the string. ... The most common use of template literals is string interpolation—the ability to embed variables and expressions directly inside a string.
🌐
Career Karma
careerkarma.com › blog › javascript › javascript string interpolation: a beginner’s guide
JavaScript String Interpolation: A Beginner’s Guide | Career Karma
December 1, 2023 - You can add values such as variables and mathematical calculations into a string using interpolation. Do you need to add a value inside a JavaScript string? The template literal syntax has you covered.
🌐
Dmitri Pavlutin
dmitripavlutin.com › javascript-template-strings
How to Use Template Strings in JavaScript
March 21, 2023 - The string interpolation in JavaScript is done by template literals (strings wrapped in backticks `) and ${expression} as a placeholder.
🌐
Ben Ilegbodu
benmvp.com › blog › nested-string-interpolation-in-javascript
Nested string interpolation in JavaScript | Ben Ilegbodu
And it turns out that that Just Works™. I was afraid that the second backtick to start the nested interpolation would be parsed as the closing backtick from the beginning, but apparently once you're inside of a ${ } expression another set of backticks can be used! To be honest, it's a bit gnarly to read. I should probably break it up into two expressions like: const locationSuffix = venue ? ` (${venue})` : '' const fullLocation = `${location}${locationSuffix}` But it's still pretty cool to know that I've got nested string interpolation in my tool bag.
🌐
DEV Community
dev.to › isaiah2k › string-interpolation-in-javascript-1gpb
String Interpolation in JavaScript. - DEV Community
October 15, 2024 - In older versions of JavaScript, this meant using the + operator to join strings together through a process called string concatenation. However, with the introduction of template literals in the JavaScript ES6(2015) update. We now have a cleaner way to insert variables into strings, called string interpolation.
🌐
AlgoCademy
algocademy.com › link
String Interpolation in JavaScript | AlgoCademy
In this lesson, we explored the concept of string interpolation in JavaScript. We learned how to use template literals and placeholders to create dynamic and readable strings.
🌐
Campushippo
campushippo.com › lessons › how-to-do-string-interpolation-with-javascript-7854ef9d
Campushippo
CampusHippo.com is a short-burst learning platform where users can teach or gain wisdom about tech, business, and marketing. The platform allows instructors to disperse information about hard-to-learn subjects faster than ever.
🌐
Wikipedia
en.wikipedia.org › wiki › String_interpolation
String interpolation - Wikipedia
1 month ago - JavaScript and TypeScript, as of the ECMAScript 2015 (ES6) standard, support string interpolation using backticks ``. This feature is called template literals.
🌐
W3Schools
w3schools.in › javascript › template-literals
JavaScript Template Literals - W3Schools
This tutorial will guide you through the essentials of JavaScript template literals, showing how they can simplify your coding process. Template literals are a type of string literals that enable you to embed expressions within them. These literals were introduced in ECMAScript 2015 and are enclosed by back-tick (`) character. Unlike traditional single or double quotes, template literals provide a more straightforward way to create multiline strings and perform string interpolation, which involves embedding expressions within a string.
🌐
Delft Stack
delftstack.com › home › howto › javascript › javascript string interpolation
How to Do String Interpolation in JavaScript | Delft Stack
March 11, 2025 - Learn how to perform string interpolation in JavaScript with our comprehensive guide. Explore various methods including template literals, string concatenation, custom implementations, and external libraries. Enhance your coding skills and create dynamic strings with ease.