Hey there! I'm trying to create an array where each element is a pair of objects. Something like this:
var Shelves = new arr[][]
var books = new Books[] ;
Shelves[book[i], book[j=i+1]], [book[i+1], book[j=i+1]] and so on......;
I know how to use a for loop to get the elements, but struggling with adding them as pairs in the array. The arr.push
method doesn't seem to work :(
build1ArrPairs(1Arr) {
if (1Arr != undefined || 1Arr!=null) {
for (var i = 0; i < 1Arr.length; i = i + 1) {
for (var j = i + 1; j <= 1Arr.length; j++) {
this.1ArrPair.push(1Arr[i] 1Arr[j]);
break;
}
}
}
}
Appreciate any help or suggestions. Thanks!