Could anyone explain me why the length is always null?
jsCountries =
0:
country: "Brazil"
photo: "source.png"
alert jsCountries.length
I dont know exactly what you want to do. If you want to use your code than the access would be
Object.keys(jsCountries).length
If however your intention is to create an array of country objects than I would suggest to initialize your jsCountries var differently
jsCountries = [
{country: "Brazil", photo: "source.png"},
{country: "Argentina", photo: "aregentina_source.png"},
...
]
Then of the following will work
jsCountries.length
In anyway I would strongly suggest not to use numeric keys for an object even thou its possible.