Here is my code
var array = [{ id: 1, name: 'test' }, { id: 2, name: 'test2' }];
I need above array to be changed like below
[{ name: 'test' }, { name: 'test2' }]
I tried with delete
array.forEach(function(arr, i) {
delete array[i].id;
});
console.log(array);
Outputs as
[ { id: 1, name: 'test' },
{ id: 2, name: 'test2'} ]
But it doesn't remove the id item. How to remove array object item?
I am using this in node v0.8.

v0.8.14and I'm seeing the correct behaviour, i.e. the id element is gone. Apologies if I'm asking the obvious, but is the code above the code that you're actually running?console.log(array), i.e.[{ name: 'test' }, { name: 'test2' }]. I'd be surprised if the native array object's behaviour had been changed between these two versions.