Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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]] : []
        )
    );
}
 
PREVIOUS NEXT
Tagged: #js #pair #values #array #objects
ADD COMMENT
Topic
Name
5+9 =