I am trying to extract some data from an array of dict but it does not work...
Here is my code :
var myarray = [{'country': 'US', 'type': 'eat'}, {'country': 'DE', 'type': 'test'}]
var arr = []
for (var key in myarray){
if (key.hasOwnProperty('country')){
arr.push(key.country)
}
}
console.log(arr);
What I want at the end is this arr = ['US', 'DE']
I precise I am using React.js maybe there is a function more efficient to do that ... but I did not found...
Here is my code : http://jsfiddle.net/n3o61bcw/
Thank you a lot for your help !