As the comments have indicated, I think you’re confused about what exactly you need – what you’re describing is simply a multi-dimensional array, not an object at all. You’ll find plenty of information online by just googling that term.
As for your specific example, here’s how you could do it with a couple of for-loops:
array1 = ["A", "B", "C", "D", "E", "F", "G"];
makeGrid(array1, 2);
makeGrid(array1, 3);
function makeGrid(array, step) {
const grid = [];
for (i = 0; i < array.length; i+= step) {
const tmp = [];
for (j = 0; j < step && array[i + j]; j++) {
tmp.push(array[i+j]);
}
grid.push(tmp);
}
console.log(grid);
}
solved How to convert an array to a object