All lessons

Working with Text

7 min · JavaScript

Join strings, measure them, and drop values into template literals.

JavaScript · Working with Text0/5 cleared

Enemy 1 of 5

Text values are called strings — any sequence of characters inside quotes, from a single letter to a full sentence. You've been using them for every console.log call so far; now it's time to combine and manipulate them.

Join two strings with + — the same operator used for addition, but JavaScript uses it for concatenation (gluing text together) whenever at least one side is a string. This double duty is convenient once you're used to it, but it's exactly why mixing numbers and strings with + can surprise you, as the previous lesson mentioned.

You
Packet Wolf

Loading editor...

Ln 1, Col 1Spaces: 4
Sign up to fightTarget output: Hello, Ada