So, here, I am trying to create a two dimensional array; an array of arrays. However, whenever I try to push a value to the nested array, I receive the error seen in the title. In these for loops, the 'b' array is full of a list of strings, which are all received in a certain format, and the code then breaks it up and pushes it to the values in the 2-D array for further working.
var c = []
for(var u = 0; u < b.length; u++){
c[u] = new Array(0);
for(var y = 0; y < b[u].length; y++){
c[u][y].push(b[u].substring(b[u].indexOf('\"'), b[u].indexOf(",")));
b[u] = b[u].substring(b[u].indexOf(',') + 1);
}
}
I've looked on the other solutions here on stackoverflow; Either I can't wrap my head around them, or they're not applicable here. I can't tell what's wrong here. Help, please.
b.lengthis zero; at the start there's nothing in the arrays yet, so the outer loop will perform no iterations..push().c[u].push(...)instead ofc[u][y].push(...).