2

これが私のコードです

var array = [{ id: 1,  name: 'test' }, { id: 2,  name: 'test2' }];

上記の配列を以下のように変更する必要があります

[{ name: 'test' }, { name: 'test2' }]

削除してみました

array.forEach(function(arr, i) {
    delete array[i].id;
});
console.log(array);

次のように出力します

[ { id: 1, name: 'test' },
  { id: 2,  name: 'test2'} ]

idしかし、それはアイテムを削除しません。配列オブジェクト項目を削除するには?

これをノードv0.8で使用しています。

4

3 に答える 3