Last active
September 4, 2019 12:32
-
-
Save Abrifq/7c5002128f0047f667b4e150f04b06c6 to your computer and use it in GitHub Desktop.
This function takes an array as an input, then produces a NOT match filter Function, which can be used with Array.prototype.filter later on.
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 notMatch = array => value => !array.includes(value); | |
//testing | |
const newFilter = notMatch([3,5]); | |
const array125 = [... Array(125).keys()]; | |
console.log ( array125.length); | |
const filteredArray = array125.filter(newFilter); | |
console.log ( filteredArray.length) | |
//Lets try to get the [3,5] array back using two NOT filters | |
console.log ( array125.filter ( notMatch(filteredArray)) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment