I've been working on improving my JavaScript skills but I seem to have hit a roadblock.
var schemes = {
"own" : {
"creatures" : ["creature1","creature2","creature3","creature4"],
"spells" : ["spell1","spell2","spell3","spell4"],
"items" : ["item1","item2","item3","item4"]
},
"enemy" : {
"creatures" : ["creature1","creature2","creature3","hidden"],
"spells" : ["spell1","spell2","hidden","hidden"],
"items" : ["item1","item2","item3","hidden"]
}
};
Here is the array I'm working with.
I am attempting to use a for each loop, similar to what I know from PHP, but it seems that JavaScript is treating 'schemes' as an object and therefore I can't do:
for (var i=0;i<schemes.length;i++) {
//code
}
What could I be missing? The console says 'schemes.length' is undefined.