Cannot set property '0' of 2D array
Solution 1:
You need to define each child array, e.g.
var vehicles = []; // parent array;
vehicles[0] = []; // first child array;
so you would need:
for (var i = 0; i < rows; i++) {
var vehicles[i] = [];
... rest of code here ...
}
Solution 2:
vehicles[i]
has no value assigned to it.
Add a line:
vehicles[i] = [];
at the top of the loop.