Based on http://ie.microsoft.com/testdrive/HTML5/ECMAScript5Array/Default.html, I thought IE9 supports indexOf in array but the following breaks. Any idea why?
<script type="text/javascript">
var a = [59, 20, 75, 22, 20, 11, 63, 29, 15, 77];
var result = a.indexOf(32);//
document.write(result);
</script>
Error message as below:
SCRIPT438: Object doesn't support property or method 'indexOf'
test.php, line 9 character 1
Are you sure your page is running in IE9 mode? Check in dev tools (F12). If you have old DOCTYPE you might be seeing your page in IE8/7 mode, so indexOf is not supported. If you are running in IE9 mode then it works just fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With