What is wrong in my code plz help


#1

what is wrong in my code plz help...
var userChoice= prompt("Do you choose rock, paper or scissors?");
var computerChoice= Math.random();
console.log(computerChoice);
{
if((computerChoice=0)&&(computerChoice<=0.33)){
console.log("rock");
}
else if((computerChoice=0.34)&&(computerChoice<=0.66){
console.log("paper");
}
else if((computerChoice=0.67)&&(computerChoice<=1))
{
console.log("scisors");
}
}


Rock exercise part 2
#2

@akanshyadash,

In your IF condition you are using the so-called logical AND operator,
then =both= sub-conditions on the left and right should render to a Boolean true
to get a Resulting true from your AND evaluation......
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators

In a condition you normally use a comparison operator
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators
and NOT as you are using
the assignment operator.....
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators

Have a read through....
https://discuss.codecademy.com/t/rock-exercise-part-2/31761/2?u=leonhard.wettengmx.n


#3

An FYI, I am not @akanshyadash. I am lodum. Evidently our questions became entangled, and I don't know if @akanshyadash received your response.
However, I thank you for the references, I read them all.


#4

For one thing, its asking you to change the variable, not log it.

computerChoice = "rock"

and also you don't need to write parameters for the "else" part of the statement. Everything not already accounted for (.67 and above) will return scissors.