Reputation: 9338
https://caniuse.com/#search=find states The find() method is not supported by IE11.
At the same time I'm testing this find() method in IE11 and I didn't find any traces of any wrong behavior.
I've also tested in IE11 the code
function isPrime(element, index, array) {
var start = 2;
while (start <= Math.sqrt(element)) {
if (element % start++ < 1) return false;
}
return (element > 1);
}
console.log([4, 5, 8, 12].find(isPrime)); // 5
from SO: Array.prototype.find() is undefined
Yes, in IE11 it returns the expected result of 5 instead of TypeError: undefined is not a function, as SO: Array.prototype.find() is undefined in 2014 stated.
So... Am I missing something and IE11 really doesn't work properly with Array.prototype.find , or the last updates of IE11 that were made a while ago (but later than the SO question above was discussed in 2014) became to support this method?
Is https://caniuse.com/#search=find correct when says IE11 doesn't support Array.prototype.find ? Any evidence?
Thank you.
UPD: here is the screen of my IE11:
Upvotes: 2
Views: 2326
Reputation: 24945
You can try following steps to validate:
[1,2,3].find(function(n) { !!n; })
This is what I get:
Upvotes: 3
Reputation: 944203
Everything you have read is correct. There is something flawed about your tests. Perhaps you included a Polyfill that added the method in IE11.
Upvotes: 6