Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

combinantion of single array in node js

function combo(array){
    let results = [];
    for (let i = 0; i < array.length - 1; i++) {
    for (let j = i + 1; j < array.length; j++) {
        results.push(`[${array[i]} ${array[j]}]`.split(' '));
    }
    }

    return results;
}
 
PREVIOUS NEXT
Tagged: #combinantion #single #array #node #js
ADD COMMENT
Topic
Name
3+8 =