Favorites

JavaScript `...${}` Template literal Operator

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
`...${}`
JavaScript Other OperatorThis operator is supported by all modern browsers.
Updated 28th November 2026

Template literals are strings written in backticks that can span several lines and include values with ${expression}.

Description

A template literal is a string written with backticks. Expressions inside ${...} are evaluated and inserted (interpolation), and the string can span multiple lines without escape characters. It's usually clearer than joining strings with +.

A function name placed before the backtick creates a tagged template: the function receives the string parts and the values separately and can return anything. String.raw is a built-in tag, and libraries use tags for things like safely escaping HTML or defining CSS. Inserting user input into HTML with a template literal doesn't escape it, so take care to avoid cross-site scripting.

To include a literal backtick in a template, escape it with a backslash, and to include a literal ${, escape the dollar sign: \${. Any expression can go inside the placeholders, including function calls, ternaries and other template literals, and the result is converted to a string. Leading indentation on later lines is part of the string, which matters when building multi-line text.

Properties

Operator
`...${}`
Category
Other
Precedence
n/a
Associativity
n/a

Syntax

`text`
`text ${expression} text`
tag`text ${expression}`

Example

const name = 'Sam', items = 3;
console.log(`Hi ${name}, you have ${items * 2} points.`);
console.log(`Line one
Line two`);

function upper(strings, ...values) {
  return strings.reduce((out, s, i) => out + s + (values[i] ?? '').toString().toUpperCase(), '');
}
console.log(upper`Hello ${name}!`);

Browser Support

The following information will show you the current browser support for the `...${}` operator. Hover over a browser icon to see the version that first introduced support for this operator.

This operator is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee