13/13 Loop a game 3 times


#1

I tried merging the Rock, Paper Scissors and for loops but then I don't see any text.

// Round counter. Best of 3
for (var round = 1; round > 3; round++) {
console.log("Round " + round +"!");

// Game starts
var com1Choice = Math.random();
var com2Choice = Math.random();

// Defines computer choice to Rock, Paper or Scissors

//Computer 1
if (com1Choice < 0.34) {
com1Choice = ("Rock");
} else if (com1Choice < 0.64) {
com1Choice = ("Paper");
} else {
com1Choice = ("Scissors");
}
console.log(com1Choice);

// Computer 2
if (com2Choice < 0.34) {
com2Choice = ("Rock");
} else if (com2Choice < 0.64) {
com2Choice = ("Paper");
} else {
com2Choice = ("Scissors");
}
console.log(com2Choice);

// Who wins?

function compare (com1Choice, com2Choice) {
if (com1Choice === com2Choice) {
return "It's a tie!";
}
else if (com1Choice === "Rock") {
if (com2Choice === "Scissors") {
return "Rock wins!";
}
else {
return "Paper Wins!";
}
}
else if (com1Choice === "Paper") {
if (com2Choice === "Rock") {
return "Paper wins!";
}
else {
return "Scissors wins!";
}
}
else if (com1Choice === "Scissors") {
if (com2Choice === "Paper") {
return "Scissors wins!";
}
else {
return "Rock wins!";
}
}
}
// Result
console.log(compare(com1Choice, com2Choice));
};


#2

If round is 1 and 1 is not bigger than 3 the condition is false and so the loop is not run.