I have an object array:
[
{ name: 'one', value: '1' },
{ name: 'two', value: '22' },
{ name: 'three', value: '333' },
add: [Function],
delete: [Function]
]
How can I delete an object with name: 'two'
?
[
{ name: 'one', value: '1' },
{ name: 'three', value: '333' },
add: [Function],
delete: [Function]
]
I've tried splice()
and delete
, but they don't work in my case.
Also tried to iterate the whole array and rebuild it depending on what I want to remove, but that doesn't seems like a good approach...
Generally, I want to implement something like an ArrayList
to allow easy find/add/remove/modify.
Maybe I structure my code wrong?
arr[3]
the functionadd
? – Jon Aug 9 '13 at 14:55[Function]
). – James Allardice Aug 9 '13 at 15:01