let linkMatrix = [
[0,0,1,0],
[1,0,0,1],
[1,1,0,1],
[0,1,0,0]
];
let newMatrix = [];
function linkToPage(){
for(let j = 0; j < linkMatrix.length; j--){
newMatrix = linkMatrix.splice(linkMatrix[j], 1);
console.log(linkMatrix + " Here is linkMatrix");
for(let i = 0; i < newMatrix.length; i++){
newMatrix.splice(newMatrix[i]);
console.log(newMatrix + " Here is newMatrix");
}
}
**My goal with this code is to iterate through the first array while excluding it from the loop. Then, I want to traverse the remaining arrays and extract the value at the index that was removed. To clarify further: if we had an array like arr = [[0,1],[1,0],[1,1]], removing [0,1] since it's arr[0], I plan to access the 0 index of the other arrays to retrieve the values 1 and 1. Next, I'll remove arr[1] and cycle through arr[0] and arr[2] to obtain the values at the 1 index of those arrays, resulting in [1,1]. **
**In essence, the desired outcome from my link matrix would be:
[0,0,1,0] = 2
[1,0,0,1] = 2
[1,1,0,1] = 1
[0,1,0,0] = 2
This is because there are 2 arrays pointing to the first array, as well as the second and fourth arrays, while only one array points to the third array.
**