Array Zero Indexing
Multiple Choice Beginner
Question
In let arr = [10, 20, 30], what is arr[0]?
Hint
The first element is at index 0, not 1.
Explanation
JavaScript arrays are zero-indexed, meaning the first element is at index 0. So arr[0] is 10, arr[1] is 20, and arr[2] is 30. The last element can be accessed as arr[arr.length - 1] or arr.at(-1).
Related Resources
Related Lessons
- Arrays
Learn how arrays work.
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.