I'm trying to understand why this bound function is behaving differently when called in these different ways. Here's the example.
var str = 'sss';
var f = str.endsWith.bind(str);
// false?
console.log(['s', 'q', 'r'].some(f))
// true
console.log(['s', 'q', 'r'].some(value => f(value)))
// true
console.log(f('s'))
What am I missing, why isn't the first call returning true?
indexandarrtoendsWithand the second parameter ofendsWithislength(it's equivalent to.some((value, index, arr) => f(value, index, arr))) see: Why does parseInt yield NaN with Array#map?