Array Length Property
Multiple Choice Beginner
Question
After running let a = [1,2]; a.push(3); what is a.length?
Hint
push adds one element to the end.
Explanation
The array starts with 2 elements [1,2]. After push(3) it becomes [1,2,3] which has 3 elements. The length property reflects the current number of elements, so a.length is 3.
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.