0

Array.length: Why 2 instead of 3?

I found this quiz question: var arr = []; arr[0] = "x"; arr[1] = "y"; arr.key = "c"; console.log(arr.length) // 2

6th Jul 2020, 8:59 PM
Prof. Dr. Zoltán Vass
5 Respostas
+ 1
Martin Taylor Thank you! I’ve changed the code as you suggested : (null) {"0":"x","1":"y","key":"c"} https://code.sololearn.com/WDfnN326rhKu/?ref=app
6th Jul 2020, 9:39 PM
Prof. Dr. Zoltán Vass
+ 1
Martin Taylor Thank you so much for correcting me.
7th Jul 2020, 11:00 AM
Sachin Kumar Shaw
Sachin Kumar Shaw - avatar