1

I have a JavaScript app that asks 11 multiple choice questions. I want to list all possible combinations of selections.

Eight questions have 2 options (say A or B).

Two questions have 3 options.

One question has 4 options.

The total number is calculated as so: (2 to the 8) * (3 to the 2) * (4) = 9216

Challenge: how to list them.

Here's a start...but stumped on the function.

var Q1 = [A, B];
var Q2 = [A, B];
var Q3 = [A, B];
var Q4 = [A, B];
var Q5 = [A, B, C];
var Q6 = [A, B];
var Q7 = [A, B, C];
var Q8 = [A, B];
var Q9 = [A, B];
var Q10 = [A, B];
var Q11 = [A, B, C, D];

var all = [Q1,Q2,Q3,Q4,Q5,Q6,Q7,Q8,Q9,Q10,Q11]

for (var i=0;i<all.length;i++){
    // ?
}
Norman Cousineau
  • 327
  • 1
  • 3
  • 15

0 Answers0