Strings: Working with Text

Learn how JavaScript stores and manipulates text using strings — from creating them with quotes to combining and transforming them.

Step 1 of 5

Text lives inside quotes

Every piece of text you see on a website — usernames, search results, error messages, button labels — is stored in JavaScript as a string. A string is simply a sequence of characters (letters, numbers, spaces, symbols) wrapped in quotes. Without strings, JavaScript couldn't handle any text at all — no displaying names, no reading what someone typed, no showing messages.

You create a string by wrapping text in quotes. JavaScript gives you three options: single quotes ('hello'), double quotes ("hello"), or backticks (`hello`). Single and double quotes work identically — pick one style and be consistent. Backticks are special and we'll explore them shortly.

Think of it this way: A string is like a necklace of beads — each bead is a character, and you can count them, rearrange them, or pick out specific ones. The quotes are like the clasp that holds the necklace together: they mark where the string starts and ends.
Web Standard
Strings in JavaScript are encoded as UTF-16, which means they can hold characters from virtually any language — English, Chinese, Arabic, emoji, and more. When you write `let greeting = "こんにちは";`, JavaScript handles it just fine.
Learn more on MDN
JAVASCRIPTREAD ONLY
CONSOLE
Click "Run" to execute your code...