Skip to main content
Module 2 · Lesson 1 of 45/32 in the course~15 min
Module lessons (1/4)

Strings and template literals

Lesson preview5 hands-on exercises readyJavaScript Course · Module 2 — Strings and numbers

Quotes, escapes, backticks and ${...} interpolation to compose text.

What you'll learn in this lesson

  • Choose the cleanest string delimiter ('...', "...", or backtick) while avoiding unnecessary escape sequences.
  • Use template literals with interpolation ${expr} and multiline text without verbose concatenations with +.
  • Understand the danger of overloading + between numbers and strings (1 + '2' === '12').
  • Write pure functions that format dynamic messages readably.

Overview

Strings are immutable sequences of characters. In modern JavaScript, the default format for composing dynamic text is backtick-delimited template literals, which support interpolated expressions with ${ ... } and natural multiple lines.

Template literals are often combined with .map() to format records into readable summaries.

Sections covered in this lesson

  1. 1Mental model: static strings vs template literals
  2. 2Progressive examples
  3. 3Guided laboratory
  4. 4Check for understanding
Pro Lesson · Module 2 — Strings and numbers

Unlock "Strings and template literals" and the full JavaScript Course curriculum

Quotes, escapes, backticks and `${...}` interpolation to compose text.

Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.

  • Instant access to all advanced modules in JavaScript Course plus 17 more courses
  • Hands-on browser exercises with automated test suites and solutions
  • 14-day money-back guarantee processed via Paddle.com

14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.