Where I can write my game and see the result?


#1



Replace this line with your code.


#2

You can type it out in any text editor or even notepad save the file and run it in browser ..


#3

is there any website can i write inside it and see the result


#4

I would suggest repl.it


#5

Yes..

JS bin


#6

thanks but I have more one Q what is the problem with my game
var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if (computerChoice < 0.34) {
computerChoice = "rock";
} else if(computerChoice <= 0.67) {
computerChoice = "paper";
} else {
computerChoice = "scissors";
} console.log("Computer: " + computerChoice);
var compare=function (choice1,choice2){
if(choice1 === choice2) {
return "The result is a tie";
}
else if(choice1 === "rock"){
if (choice2 === "scissors"){
return"rock wins";
}
else{
return "paper wins";
}
}
else if (choice1 === "paper"){
if (choice2 === "rock"){
return "paper wins";
}
else{
return "scissors wins";
}
}
else if(choice1 ==="scissors"){
if(choice2 === "rock"){
return "rock wins"; }
else {
return"scissors wins";
}
}
};
compare(userChoice,computerChoice);


#7

I write in repl.it and it is not running


#8

Have a look at this it works :slight_smile:
Make sure to put it under the tab Javascript/JS


#9

Thanks
but I write my game inside it but it does not work


#10

Here's it on repl.it


#11

thank you soo much :slight_smile: