Welcome Guest, Not a member yet? Register   Sign In
Javascript and hierarchical arrays/objects??
#1

[eluser]umbungo[/eluser]
How do i do the following in javascript??

Code:
sIndex[artist][album][song] = id;

The equivalent would work fine in PHP. The above would be in the middle of an iteration through each item of a playlist.*

When i do it like above, the console returns 'cannot read property [album] of undefined.

*E: ...so there may be multiple songs with the same album or artist; there should be only one entry (array branch?) for each unique item. The best I have managed so far (also a mess) will only store one song and one album for each artist.




Theme © iAndrew 2016 - Forum software by © MyBB