for (kind in animals) {
content += animals[kind][0].name + '<br>';
}
This returns the first name of each animal kind from my JSON. I'm struggling to get ALL names rather than just [0]. Since there doesn't appear to be a simple wildcard like [*], I tried putting a second for loop inside the first one like so:
for (var kind in animals) {
for (var i in kind) {
content += animals[kind][i].name + '<br>';
}
}
But as it should, that simply doesn't work.
I know this is easily accomplished with something like Underscore.JS but I would really like to do it with just pure vanilla.
kindis two different things.kindis a key (property name). But you use it as object which is wrong