function uniquePairs(arr) {
return arr.flatMap((item1, index1) =>
arr.flatMap((item2, index2) =>
(index1 > index2) ? [[item1, item2]] : []
)
);
}
function uniquePairs(arr) {
return arr.reduce((acc, current, i) =>
[...acc, ...(arr.slice(i + 1).map(val => [current, val]))], []);
}