Hi,
I understand that the code below evaluates multiplication of a simple array
var arr = [[2,3],[2,3]];
var product = 1;
For (i=0; i<arr.length; i++) {
For (j=0; j<arr[i].length; j++) {
product *=arr[i][j];
}
}
How would you multiply an array like this:
[[2,3,[2,3]], [2,3], [2,3]]?
I’ve tried this, but it doesn’t work.
var arr =[[2,3,[2,3]], [2,3], [2,3]];
var product = 1;
For (i=0; i<arr.length; i++) {
For (j=0; j<arr[i].length; j++) {
For (k=0; k<arr[j].lenght; k++) {
product *=arr[i][j][k];
}
}