I have these JSON:
var tracks = {
"track1": ['Baby Be Mine', 'Michael Jackson', 'baby_be_mine'],
"track2": ['Thriller', 'Michael Jackson', 'thriller'],
"track3": ['Humane Nature', 'Michael Jackson', 'humane_nature']
};
Well, I want to access to the previous track, for example: I have "track2" and I want to store in a variable called previous, the location of "baby_be_mine".
I have this for and inside of it I have tried to do that with track-1, but the console got me undefined.
for(var track in tracks){
if(track-1 >0){
previous = tracks[track-1][2];
}