Hi, I'm not a programming expert, I need a little help.
Using JavaScript, I would like to create an array [5, 6, 7, 8, 9, 10] and then I need a loop that fills me with another array called Role [].
If (array == 5) I randomly want 3 Role elements to have the value "Resistance" and 2 "Spy".
Else if (array == 6) I randomly want 4 Role elements to have the value "Resistance" and 2 "Spy".
Else if (array == 7) I randomly want 4 Role elements to have the value "Resistance" and 3 "Spy".
Else if (array == 8) I randomly want 5 Role elements to have the value "Resistance" and 3 "Spy".
Else if (array == 9) I randomly want 6 Role elements to have the value "Resistance" and 3 "Spy".
Else if (array == 10) I randomly want 6 Role elements to have the value "Resistance" and 4 "Spy".
Thank you in advance.
Top comments (1)
So is Role meant to be an array of arrays? Like so
[["Resistance", "Resistance", "Resistance", "Spy", "Spy"], ["Resistance", "Resistance", "Resistance", "Spy", "Spy"]]
.