String Immutability
Concept Check Medium
Question
What does it mean that strings are immutable in JavaScript?
Hint
Think about whether you can do str[0] = 'X'.
Explanation
Strings are immutable — you cannot change individual characters after the string is created. Doing str[0] = "X" does not modify the string. Instead, you create a new string using methods like replace(), slice(), or toUpperCase(). The original string always stays the same.
Related Resources
Related Lessons
- Strings and Text
Learn how strings and text work in programming.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.