Add your own indexOf in the JavaScript Array object

Internet Explorer does not have an indexOf method in the Array object. Here is how you can add your own:

for(var i=0;i
Use it like this:

var a=new Array('aaa','bbb','ccc');
alert(a.indexOf('bbb')); // Shows 1 as it is the index of 'bbb' in the a Array.
alert(a.indexOf('b')); // Shows -1 since 'b' is not a member of the a Array.