Template literal
A JavaScript string literal delimited by backticks that supports multiline text and embedded expressions.
Web Components in Action
An ECMAScript string literal delimited by backticks that supports interpolation and multiline content.
- How it is used
- Uses template literals to keep multiline HTML/CSS readable and insert values into Web Component markup.
- How deep it goes
- Works through backticks, placeholders, imported render functions, and generated menus; defers fuller expression syntax to an appendix.
- Examples
- Builds a business-card customizer with interpolated contact fields and generated logo and background selectors.
- What you can do after
- Build it from scratch: place a Web Component’s HTML/CSS in a separate JavaScript module and generate markup from supplied values.
Read how Web Components in Action explains template literal →
Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond
A JavaScript literal syntax that supports embedded expressions, multiline text, and optional tag functions for processing the literal parts and substitutions.
- How it is used
- Makes dynamic greetings and product HTML readable without chains of string concatenation.
- How deep it goes
- Explains interpolation, multiline literals, tagging, and evaluation-time reuse limits; poses tag implementation as an exercise.
- Examples
- Uses cart messages, multiline greetings, product HTML, and an object-to-HTML-attributes tag exercise.
- What you can do after
- Practice/perform writing interpolated multiline strings, wrapping literals for reuse, and designing a tag for object values.
Building User-Friendly DSLs
A JavaScript literal syntax delimited by backticks that can represent multiline strings and interpolate expressions.
- How it is used
- Uses ES2015 template literals with embedded expressions to implement template functions that generate code from pieces of an AST.
- How deep it goes
- Explains multiline strings, backtick delimiters, embedded expressions, and template-function use, while deferring detailed reference information.
- Examples
- Demonstrates a generatedIndexJsx template function copying runtime/index.jsx and runs it through the generator command.
- What you can do after
- Build it from scratch: create a template function that emits generated code and invoke it from a generator.
Read how Building User-Friendly DSLs explains template literal →
Related concepts
- interpolationuses · Interpolation is the construction of text by inserting evaluated values or expressions into designated placeholders in a string or template.
- string literalalternative to · A string literal is source-code notation that directly represents a string value.
- concatenationalternative to · Concatenation is the operation of joining ordered sequences end to end to form a single sequence.
- JavaScriptkind of · JavaScript is a high-level, dynamically typed, multi-paradigm programming language standardized as ECMAScript and used for web and general-purpose programming.
- stringuses · A string is a programming-language value representing an ordered sequence of characters or character units as text.
- HTML template elementcontrasts with · The HTML template element holds inert markup that can be cloned and inserted into a document.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


