function neighbor(color_indices) {
var neighbor_face = [];
var neighbor_index_temp = [];
//initialize to the given length
var color_indices_length = color_indices.length;
for (var i = 0; i < color_indices_length; i++) {
if (color_indices[i] % 2 == 0 ) {
if (color_indices[i] % 10 == 8) {
neighbor_index_temp[0] = (color_indices[i]) + 1;
neighbor_index_temp[1] = (color_indices[i]) - 17;
neighbor_index_temp[2] = (color_indices[i]) - 19;
//check if it is in the array
for (var k = 0; k < 3; k++){
if ($.inArray(neighbor_index_temp[k],color_indices) != -1){
color_indices.push(neighbor_index_temp[k]);
}
}
The input : color_indices would be an array of the global variable. I am trying to push neighbor_index_temp of only new to the color_indices. I tried to implement $.inArray but it doesn't seem to work. Any suggestions?
Thanks!