2016-08-24 89 views

回答

1

var arr = [{"Key":"value1"},{"Key":"value2", "id":"id"}]; 
 
var anArrayOfKeyValues = []; 
 

 
arr.forEach(function(ob, i) { 
 
    if("Key" in ob) anArrayOfKeyValues.push(ob.Key); 
 
}); 
 

 
console.log(anArrayOfKeyValues); // ["value1", "value2"]

+0

非常感謝@Roko。這是我正在尋找的解決方案。 – user3213490

+0

@ user3213490不客氣 –