+ 9

Why the output is 2???

var arr = ["","",]; alert(arr.length) _______________________________________ There are two strings in the array but 1 number which is not in quotation marks. There are two commas it means three items can be added. David Carroll , bobbie

10th Jul 2019, 1:29 PM
Tahir Usman
Tahir Usman - avatar
4 Answers
10th Jul 2019, 4:24 PM
David Carroll
David Carroll - avatar
+ 9
It is arr.length asking for the length not for index💧 Alex Tusinean đŸ”„
10th Jul 2019, 1:35 PM
Tahir Usman
Tahir Usman - avatar
+ 8
Thank you David Carroll
10th Jul 2019, 4:45 PM
Tahir Usman
Tahir Usman - avatar
+ 2
11th Jul 2019, 4:19 AM
Sonic
Sonic - avatar