IE9 array does not support indexOf

后端 未结 3 910
青春惊慌失措
青春惊慌失措 2021-01-11 23:57

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?



        
3条回答
  •  感情败类
    2021-01-11 23:58

    It might help if you declare the array explicitly:

    var a = new Array(1,2,3);
    a.indexOf(2);
    

提交回复
热议问题