Why doesn't indexOf work on an array IE8?

后端 未结 7 783
耶瑟儿~
耶瑟儿~ 2020-11-22 04:15

The below function works fine on Opera, Firefox and Chrome. However, in IE8 it fails on the if ( allowed.indexOf(ext[1]) == -1) part.

Does anyone know w

7条回答
  •  粉色の甜心
    2020-11-22 04:58

    Please careful with $.inArray if you want to use it. I just found out that the $.inArray is only works with "Array", not with String. That's why this function will not working in IE8!

    The jQuery API make confusion

    The $.inArray() method is similar to JavaScript's native .indexOf() method in that it returns -1 when it doesn't find a match. If the first element within the array matches value, $.inArray() returns 0

    --> They shouldn't say it "Similar". Since indexOf support "String" also!

提交回复
热议问题