Horje
generate combinations of values from multiple array javascript Code Example
generate combinations of values from multiple array javascript
function cartesian(...args) {
    var r = [], max = args.length-1;
    function helper(arr, i) {
        for (var j=0, l=args[i].length; j<l; j++) {
            var a = arr.slice(0); // clone arr
            a.push(args[i][j]);
            if (i==max)
                r.push(a);
            else
                helper(a, i+1);
        }
    }
    helper([], 0);
    return r;
}
get combinations of two js
var array1=["A","B","C"];

var array2=["1","2","3","4"];

console.log(array1.flatMap(d => array2.map(v => d + v)))




Javascript

Related
javascript select input text on focus Code Example javascript select input text on focus Code Example
Node require module Code Example Node require module Code Example
make textarea auto height Code Example make textarea auto height Code Example
node js and react js difference Code Example node js and react js difference Code Example
import jquery into js file Code Example import jquery into js file Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10