the title explains it all
somehow I'd like to use the method "Combination" that math has, this is the Wikipedia page to be clear: https://en.wikipedia.org/wiki/Combination
I have already found the solution with two loops, I want to do it in one loop
example:
const arr = [1, 2, 3, 4]
function getPairs(arr) {
/*
desired return:
[
[1, 2], [1, 3], [1, 4],
[2, 3], [2, 4],
[3, 4]
]
*/
}