JSFiddle - React, Tailwind, and code Playground

by Alex Azuero

JavaScript

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 (userChoice, computerChoice) {
if (userChoice === computerChoice) {
console.log("The result is a tie!");
}else {
    console.log("somethingelse");
}
};
compare();