I've been trying to fill up a 2D array with JavaScript and I keep crashing my browser so I assume I have infinite recursion but I can't seem to find my error. Here's my code:
//The two sequences to compare
var sequence1 = "ATTGCTGACTTCA"
var sequence2 = "ATGCTACTA"
//Creates multi-dimensional array dependent on sequence lengths
var arr = new Array(sequence1.length + 1)
for (i = 0; i < sequence1.length + 1; i++) {
arr[i] = new Array(sequence2.length + 1);
}
//Fills array with 0s
for (i = 0; i < arr.length; i++) {
var col = i;
for (i = 0; i < arr[col].length; i++) {
arr[col][i] = 0;
}
}