+ 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
4 ответов
+ 5
Tahir Usman Trailing commas in arrays are ignored in Javascript.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Trailing_commas
+ 9
It is arr.length asking for the length not for index💧 Alex Tusinean 🔥
+ 8
Thank you David Carroll
+ 2
💧 Alex Tusinean 🔥 not quite. See David Carroll 's answer.