I have a sheet like this:

And I have this function:
function getRangeAsArrays(sheet) {
var dataRange = sheet.getRange(2, 1, sheet.getLastRow(), sheet.getLastColumn());
var data = dataRange.getValues();
var array = [];
for (var r=0; r<sheet.getLastColumn(); r++) {
for (i in data) {
var row = data[i];
array.push(row);
}
}
return array;
}
Which I use to build a listboxthis way:
var recipientArray = getRangeAsArrays(activeSheet);
var item3Panel = app.createHorizontalPanel();
item3Panel.add(app.createLabel("recipient"));
var listBox = app.createListBox().setName('item3');
for(var i = 0; i < (recipientArray.length); i++){
Logger.log("recipientArray[i][2] = " + recipientArray[i][3]);
Logger.log(" i = " + i);
listBox.addItem(recipientArray[i][4]);
}
item3Panel.add(listBox);
But when I iterate over the array length (4 rows), I got this (unexpected to me) result and the logs shows i variable goes until 14:

Since recipientArray.length should give me the first dimension of the 2 dimensional array and recipientArray[i].length the second dimension, and since I want the first dimension (number of rows) row to fix that? What is going wrong here?