Posted By

jatkins on 07/11/10


Tagged

array arrays indexof


Versions (?)

JavaScript Alternative IndexOf function (not all versions of IE feature it)


 / Published in: JavaScript
 

  1. function find_index(array, string) {
  2. var i = 0;
  3. for(i=0;i<array.length;i++) {
  4. if(array[i]==string) break;
  5. }
  6. return array[i] == string ? i : -1;
  7. }

Report this snippet  

You need to login to post a comment.