Can you help me figure out why the code below is returning undefined when I try to find the length of size?
var size= arr2[3].Operator;
The values for size are:
DT3702: Object
DT3703: Object
DT3704: Object
DT3705: Object
DT3706: Object
DT3707: Object
DT3708: Object
The value of arr2[3]
is:
Operator: Object
DT3702: Object
DT3703: Object
DT3704: Object
DT3705: Object
DT3706: Object
DT3707: Object
DT3708: Object
However, I am encountering an error that says
Uncaught TypeError: Cannot read property 'name' of undefined
after trying to get the length. Can you tell me what might be causing this issue in the following code snippet?
var dataArray2 = [['TruckName', 'OperatorName']];
for (var i = 3; i < arr2.length; i++) {
for (var j = 0; j < length; j++){
dataArray2.push([arr2[i].Operator[j].Object, arr2[i].Operator[j].name]);
}
}