I have successfully accessed different arrays and their elements using a for loop and the eval function as shown below:
var Array1 = [A,B,C,D];
var Array2 = [D,B,C,A];
var Array3 = [B,C,A,D];
var Array4 = [A,D,B,C];
for(var row = 1; row <=4; row++){
for(var column = 0; column <=3; column++){
if(row<4 && eval("Array" + row)[column] == eval("Array" + (row +1))[column]){
console.log("Value of Array" + row + "column" + column + "is equal to" + "value of Array" + eval(row + 1) + "column" + column + "\n");
}
}
}
The question I have is, am I correctly using the eval function. If it is not the correct way to use the eval function how do I dynamically access different arrays in the for loop without using the eval function?