CJCoding With Joseph
← Back to Question List
JavaScript Code Walkthrough #50

Shrinking an Array with length

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

← Previous