.remove()

Removes the entries that match the provided filter. Removes all the entries from the collection if no filter is provided.

remove(filter)

Parameter

Description

filter

Callback (optional)

Function to test each element of the array. Return a value that coerces to true to keep the element, or to false otherwise

Returns

Description

The removed entries

// Note: People is a collection.

People.getAll();  // [{ id: 1, name: 'Peter', salary: 1200 }, { id: 2, name: 'Michael', salary: 900 }] 

People.remove(person => person.salary < 1000); // [{ id: 1, name: 'Peter', salary: 1200 }] 

People.getAll();  // [{ id: 1, name: 'Peter', salary: 1200 }] 

Last updated