Having just started learning JavaScript, I'm a bit confused on how to retrieve a specific key value from a JSON file:
var me = {"fcolors": ["blue", "green", "whitesmoke"],"fire": ["pink", "grey", "red"]};
I am interested in extracting only the fcolour
values
fcolour = [];
for (var key in me) {
if (me[key] instanceof Array) {
for (var i = 0; i < me[key].length; i++) {
console.log();
fcolour.push(me[key][i])
}
}
}
The desired result should be
fcolour=["blue", "green", "whitesmoke"]
Many thanks in advance and any feedback is welcomed.....