Created
April 9, 2021 09:13
-
-
Save IKatsuba/56254320ec729b6adef820475480db62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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