I am trying to support cross-browser compatibility, but the function includes() is not supported by IE ( Internet Explorer ). Does anyone know why this is the case?
Array.prototype.includes
and String.prototype.includes
is part of the ES7 (now ES2017) and ES6 (now ES2015) javascript specification respectively.
From wikipedia:
Internet Explorer ... is a discontinued series of graphical web browsers
key word: discontinued. Microsoft only develops Edge now. IE may still get security updates but it will no longer received new javascript updates or any browser specification updates.
includes()
is not supporting in Internet Explorer , can you explain me why ?
Internet Explorer doesn't support Array.prototype.includes
or String.prototype.includes
because Microsoft no longer develops IE. Those specs came after Microsoft discontinued IE, therefore, it won't get those features.
BUT WAIT
You can still use new javascript in old browser by using polyfills.
You can use core-js as a library of polyfills.
To use includes(...)
in IE, just include this at the top of of your <head>
before any scripts.
<script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.1/core.min.js"></script>