0Pricing
JavaScript Academy · Lesson

Template Literals & Common String Operations

Use template literals and essential string methods; quick tour of numbers and Date basics.

Intro

Goal: Format text with template literals and use simple string methods. Then see a quick intro to numbers and dates.

  • Template literals
  • Common string ops
  • Safe rounding
  • Date basics
Template Literals & Common String Operations — illustration 1

Template literals basics

Use backticks and ${} to insert values directly. Multi-line text is easy too.

// Template literals use backticks and ${}
// They support variables, expressions, and multi-line text
const name = "Ayla";
const score = 7;
const msg = `Hello, ${name}! Your score is ${score * 10}.`;

console.log(msg);

const lines = `Line 1
Line 2`;
console.log(lines);
Template Literals & Common String Operations — illustration 2

All lessons in this course

  1. Template Literals & Common String Operations
  2. Numbers — Integers vs Floats & Math Essentials
  3. Dates — Basics, Time Zones, Intl.DateTimeFormat
← Back to JavaScript Academy