我有有年齡和number.I希望創建一組新的陣列中有{"num":2}
(IE)的JSON數組值需要返回[{"age":2,"num":2},{"age":3,"num":2}]
取陣列,具有特定值
var array_val='[{"age":1,"num":1},{"age":2,"num":2},{"age":3,"num":2}]';
console.log(array_val);
function fetchList(array_val) {
return array_val = {"num":1};
}
array_val.filter(fetchList)
console.log(array_val);
取'JSON.parse'使用前陣。 –