Predict String Length
Predict Output Easy
Question
What does this code print?
Code
const text = "Hello World";
console.log(text.length);
Hint
Count every character including the space.
Explanation
The string "Hello World" has 11 characters: H-e-l-l-o-(space)-W-o-r-l-d. The .length property counts all characters including spaces and punctuation. The output is: 11
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.