+ 2

JavaScript Associative Aray Length

How can i get length of associative arrays?

1st Dec 2016, 8:06 AM
Mohsen
Mohsen - avatar
1 Resposta
+ 3
Well, you can use this var myarr=new Array(); myarr["hash1"]="My first array element"; myarr["hash2"]="This is second one"; myarr["hash3"]="Yeap, its third one"; document.write(Object.keys(myarr).length); Hope its help you
1st Dec 2016, 8:20 AM
Aditya kumar pandey
Aditya kumar pandey - avatar