I have the following JS array:
var items=[
{ id: 1, name: 'aa' },
{ id: 1, name: 'bb' },
{ id: 2, name: 'cc' },
{ id: 1, name: 'dd' }
];
I wan to convert it to the following.
var items=[
{ id: 1, name: 'dd' },
{ id: 2, name: 'cc' }
];
How should I go about it using JavaScript?