Whats Wrong with my code?


Im Confused here lol :laughing:

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

var computerChoice = Math.random()

 computerChoice = console.log("Paper");   
if else(computerChoice>0.3 && computerchoice<0.6){
 computerChoice = console.log("Rock");   

 computerChoice = console.log("scissors");


Hey @amanuel2,

It's supposed to be else if, not if else here:

Also, computerChoice is not supposed to change into a console.log, but a string. Take away the console.logs in everything here:



Well the second one i had but changed if it might worked but the first one my bad. I was connecting it to Java. Thats the struggle when you know too many languages.. :weary:


In Java it is else if also, not if else.


its if else. Im not talking about javascript im talking about actual Java


Would suggest putting it in the Java section then...

And I searched it up. It seems as if it is else if for Java, too.


No the code was javascript, but like when i wrote the javascript program i accidently used else if whitch we normally use in java to use in javascript. If you dont get it just move on with life.


Yes, in Java it is else if.

Documentation -> https://docs.oracle.com/javase/tutorial/java/nutsandbolts/if.html

I don't want to be mean, but seriously, it would not make any sense to use if else in any language. It would complicate logical grammar of the language.


I was reading the same thing :laughing:


Slow day dont judge me! :laughing:


It's fine :smile:

Remember about taking breaks while working / studying!


Yea i should do that more often.