String
In one line
A string is a sequence of characters — text — enclosed in quotes, like "hello" or "Ada Lovelace".
In simple words
A string is how programming languages represent text. It is an ordered sequence of characters — letters, digits, spaces, punctuation, even emoji — wrapped in quotes so the computer knows it is text and not code.
You can create strings with single quotes ('hi'), double quotes ("hi"), or backticks (\hi\`) in JavaScript. Strings can be joined (concatenated), split, searched, and transformed with methods like toUpperCase() or slice()`.
Strings are everywhere: user input from forms, file paths, error messages, JSON data. Almost every program you write will work with strings in some way.
Example
let greeting = "Hello, ";
let name = "Ada";
console.log(greeting + name); // "Hello, Ada"
console.log(name.toUpperCase()); // "ADA"
console.log(name.length); // 3Strings can be concatenated with +, transformed with methods like toUpperCase(), and inspected with .length.
Related terms
Related Resources
Related Lessons
- Data Types
Strings are covered as a core data type
Related Tools
- JSON Formatter
Format and inspect JSON string data
Learn the fundamentals
Deepen your understanding with structured lessons on this topic.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.