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.
Putting my efforts here would not clarify the question.It would help illustrate that this isn't a no-effort homework dump or write-my-code-for-me-from-scratch question, which are frowned on - see the first two links in my comment above. Searching existing questions for code that does what you want isn't the same thing as trying to write code yourselfIt would help illustrate that this isn't a no-effort homework dump or write-my-code-for-me-from-scratch questionIsn't that the whole point of reputation?isn't the same thing as trying to write code yourselfWhy do you assume that I didn't spend a couple of hours trying to code it myself which I did, and finding my code was not helpful in framing the question?