Skip to content

Instantly share code, notes, and snippets.

@IKatsuba
Created April 9, 2021 09:13
Show Gist options
  • Save IKatsuba/56254320ec729b6adef820475480db62 to your computer and use it in GitHub Desktop.
Save IKatsuba/56254320ec729b6adef820475480db62 to your computer and use it in GitHub Desktop.
const items = [1, 2, 3, 4];
//before
const itemsForDelete = items.filter(item => item % 2 === 0);
itemsForDelete.forEach(item => {
const index = items.indexOf(item);
items.splice(index, 1);
})
//after
items.deleteWhere(item => item % 2 === 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment