Create this function prototype:
Array.prototype.contains = function ( needle ) {
for (i in this) {
if (this[i] == needle) return true;
}
return false;
}
and then you can use following code to search in array x
if (x.contains('searchedString')) {
// do a
}
else
{
// do b
}