Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Array.prototype.find() vs IE11

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: enter image description here

like image 845
Haradzieniec Avatar asked Mar 12 '26 03:03

Haradzieniec


1 Answers

Everything you have read is correct. There is something flawed about your tests. Perhaps you included a Polyfill that added the method in IE11.

It does not work in IE11

like image 151
Quentin Avatar answered Mar 14 '26 17:03

Quentin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!