Function in_array for JS