The problem is that Array.indexOf and String.indexOf are very very different.
String.indexOf indeed looks for a substring in the string.
But Array.indexOf looks for an array *ELEMENT* (the ENTIRE element) that matches the given test value.
So the quick answer to your question is: Write code!
Code:
function findSubstringInArray( ary, str )
{
for ( var a = 0; a < ary.length; ++a )
{
if ( ary[a].indexOf(str) >= 0 ) { return a; } /* return element number of found match */
}
return -1; /* not found */
}
Now... If this is something you do all the time, you might want to extend the Array prototype to add a method that will do as you wish. But if it's something you only do in one place in one page, just use simple code as shown.