var theSet = ["Carel Haverbeke", "Maria van Brussel", "Donald Duck"]; function isInSet(set, person) { return set.indexOf(person.name) > -1; } console.log(ancestry.filter(function(person) { return isInSet(theSet, person); })); console.log(ancestry.filter(isInSet.bind(null, theSet))); The first console.log is clear. And the second one with bind ... at first I didn’t understand why the person is not transmitted anywhere, because he is supposed to be undefined. After all, filter takes a function whose argument is equal to each individual element of the array being searched. And then just theSet.
I understand correctly that with such a record a function is returned, but is the first argument of theSet pre-registered in it? That is, you get the normal filter filter (function (person) {return set.indexOf (person.name)> -1;}), and the set argument as if in memory, so to speak? I just want to make sure I understand how the second call option works.