Probá así:
Código PHP:
<script>
Array.prototype.in_array=function(){
for(var j in this){
if(this[j]==arguments[0]){
return true;
}
}
return false;
}
colores=['azul','índigo','violeta'];
if(colores.in_array('azul'))alert('pertenece');else alert('no pertenece');
if(colores.in_array('verde'))alert('pertenece');else alert('no pertenece');
</script>