function uniquePairs(arr) { return arr.reduce((acc, current, i) => [...acc, ...(arr.slice(i + 1).map(val => [current, val]))], []); }