I have an object of the following kind:
{ body: { entry: { body: '' }, context: '' },
contextids:
[ { uid: 'ff992fa0-817a-11e4-bea0-299f5e3c3819',
name: 'deemeetreesNotebook' },
{ uid: 'ff992fa1-817a-11e4-bea0-299f5e3c3819', name: 'public' },
{ uid: 'ff992fa2-817a-11e4-bea0-299f5e3c3819', name: 'ideas' },
{ uid: 'ff992fa3-817a-11e4-bea0-299f5e3c3819',
name: 'thingsToLearn' },
{ uid: 'ff992fa4-817a-11e4-bea0-299f5e3c3819',
name: 'wayToRussia' },
{ uid: 'ff992fa5-817a-11e4-bea0-299f5e3c3819',
name: 'polysingularity' },
{ uid: 'ff992fa6-817a-11e4-bea0-299f5e3c3819',
name: 'infranodus' },
{ uid: 'ff992fa7-817a-11e4-bea0-299f5e3c3819',
name: 'artmital' } ],
internal: 1 }
I want to reiterate through this object, and modify it in the way that it only keeps the contextids where name equals a certain string (e.g. thingsToLearn).
What is a good way to remove unwanted contextids from my original object?
Thanks!
Array#filter.contextidsis an array !