JavaScript · Junior · Question 53 of 75
What does arr.length = 0 do?
- ✓Correct answer: Removes all elements from the array in place
- 2Throws an error because
lengthis read-only - 3Creates a new empty array, leaving the old one intact
Explanation
Setting length truncates the array, and every reference to it sees the change. arr = [] instead points the variable at a new array.