[Solved] How to generate the combinations of the following in js
okay so after spending sometime i figured it out options = [‘color’, ‘size’]; optionsValues= [[‘Red’,’Blue’], [‘L’, ‘XS’]]; function combination() { var r = [], arg = arguments[0], max = arg.length-1; function helper(arr, i) { for (var j=0, l=arg[i].length; j<l; j++) { var a = arr.slice(0); // clone arr var obj = {}; obj[options[i]] = arg[i][j]; … Read more