4. Help Please!


#1

My code isnt working. please help

var userChoice = prompt("Do you choose rock, paper or scissors?")

var computerChoice = Math.random()

console.log(computerChoice)

if( computerChoice <= 0.33 ) {
console.log("rock");
}
else if( computerChoice >= 0.34) {
console.log("paper");
}
else (computerChoice >= 0.67) {
console.log ("scissors");
}

It says Oops, try again. There was a problem with your syntax.


#2

HI the else statement doesn't take any condition

if (condition) {

}
else if (condition) {

}
else{

}

#3

var userChoice = prompt("Do you choose rock, paper or scissors?")

var computerChoice = Math.random()

console.log(computerChoice);

if (computerChoice <= 0.33) {
    computerChoice = "rock";
}

else if (computerChoice >= 0.67) {
    computerChoice = "scissors";
}

else (computerChoice = "paper")

In consideration that the "else" statement does not take any conditions, I had to switch around the order of how the directions were asking to complete our instructions to make it as simple an clear as possible -- Create a condition that starts somewhere in the middle that brings it out to one end and another towards the opposite end and that leave the "else" statement for what's left in the middle!