Strings
A free lesson from Swipe Coding · JavaScript, level 2 · updated October 2026
By the Swipe team, founded by Colin · how we make lessons
Strings hold text. JavaScript gives you three ways to write a string literal: single quotes 'Hi', double quotes "Hi", and backticks `Hi` — all three produce a string. Unlike Java, JavaScript has no separate character type: a single letter like 'A' is simply a string with a length of 1.
const single = 'Hello'; const double = "World"; const backtick = `Hi there`; console.log(single, double, backtick);
Backtick strings are called template literals, and they have a superpower: you can embed expressions directly inside them using ${ } — called interpolation — without gluing pieces together with +.
const name = 'Ada';
console.log(`Hello, ${name}!`); // "Hello, Ada!"The + operator concatenates (joins) strings together. Whenever at least one side of + is a string, JavaScript converts the other side to text and joins them, rather than performing addition.
const first = 'Java';
const second = 'Script';
console.log(first + second); // "JavaScript"
console.log('Score: ' + 95); // "Score: 95"Backtick strings, called ____ literals, let you embed expressions directly inside ${ }.
What does 'Hello, ' + 'World' produce?
JavaScript has a separate type for a single character, just like Java's char.
Keep your streak going in Swipe Coding
Swipe through every level of JavaScript on your iPhone — with XP, stars, streaks, a personal advisor and the full track beyond these free levels.
Get the Swipe apps →