Answers for "js get each pair of values from an array of objects"

0

js get each pair of values from an array of objects

function uniquePairs(arr) {
    return arr.flatMap((item1, index1) =>
        arr.flatMap((item2, index2) =>
            (index1 > index2) ? [[item1, item2]] : []
        )
    );
}
Posted by: Guest on February-14-2022

Code answers related to "js get each pair of values from an array of objects"

Code answers related to "Javascript"

Browse Popular Code Answers by Language