125
rated 0 times
[
126]
[
1]
/ answers: 1 / hits: 16574
/ 6 Years ago, thu, november 29, 2018, 12:00:00
Suppose I have an array:
members = [
{name: 'Anna', class: 'one'},
{name: 'Bob', class: 'two'},
{name: 'Chuck', class: 'two'}];
removed = members.myRemoveByClass('two'); //something like
// removed is {name: 'Bob', class: 'two'}
// members is [{name: 'Anna', class: 'one'}, {name: 'Chuck', class: 'two'}]
I'm looking for something for myRemoveByClass
. ES2015 is fine or using Lodash. The array will have been ordered already. None of the questions I've seen quite match what I'm looking for.
More From » arrays