CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

Shrinking an Array with length

JavaScript code walkthrough · Question 50
mediumArrays

Code

Read carefully. What does this print?
1let a = [1, 2, 3, 4, 5];
2a.length = 3;
3a.push(9);
4console.log(a.join("-"));
5console.log(a.length);

Your answer