I need help


#1

dear hi how are you?
dear can help me in the ( computer Choice part 1 )


How can do solve problem of foodDemand?
#2

Im fine :wink:

And yes i can help you.
First try it by yourself.
If you didnt get it, post here your Code and which Lesson and Sektion you are.


#3

Build "Rock, Paper, Scissors"
Computer Choice: Part 1


#4

And what is your code ?


#5

Build "Rock, Paper, Scissors"
Computer Choice: Part 2
if(ComputerChoice === 2.33){
console.log("Rock");
}
else if(computerChoice === 1.34 - 0.66)
{
console.log("praper");
}
else {ComputerChoice === 0.67 - 1;
console.log("scissors");}


#6

This is given code an below you shoould type your own code:

var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
console.log(computerChoice);

With this code we know the value of userChoice should be one of Paper, Rock or Scissor.
And we know computerChoice must be a Value between 0 an 1 inclusive 0 and 1

Now we will type our if/else if / else statement

if(){
 
}else if () {

} else {
 
}

Codeacademy give us this information

If computerChoice is between 0 and 0.33, make computerChoice equal to "rock".
If computerChoice is between 0.34 and 0.66, make computerChoice equal to "paper".
If computerChoice is between 0.67 and 1, make computerChoice equal to "scissors"

Now we use our if /else if / else Statment and we compare. Because it is easier i turn this:
First scissor

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

then paper

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

And last rock

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

PLease try to understand what we did here.


#7

thanks sir. you can more help me in other part


#8

this is my code, it says syntax error but i cant find it

var userChoice = prompt("Do you choose rock, paper, or scissors?");
var computerChoice = Math.random();
console.log(computerChoice)
if(computerChoice >= 0.67){
computerChoice = "scissors";
} else if(computerChoice >= "scissors")
then paper

if(computerChoice >= 0.67){
computerChoice = "scissors";
} else if(computerChoice >=0.34){
computerChoice = "paper";
And last rock

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