JSFiddle - React, Tailwind, and code Playground

JavaScript

var choices  =  {rock : {name: "Rock", defeats: {scissors: "crushes", lizard: "crushes"}},
                 paper: {name: "Paper", defeats: {rock:  "covers", spock: "disproves"}},
                 scissors: {name: "Scissors", defeats:{paper : "cuts", lizard: "decapitates"}},
                 lizard: {name: "Lizard", defeats:{paper: "eats", spock: "poisons"}},
                 spock: {name: "Spock", defeats:{scissors : "smashes",rock : "vaporises"}}
                };


var computerChoice = Math.random();
if (computerChoice < 0.2) {
    computerChoice = "rock";
} else if (computerChoice <= 0.4) {
    computerChoice = "paper";
} else if (computerChoice <= 0.6) {
    computerChoice = "scissors";
} else if (computerChoice <= 0.8) {
    computerChoice = "lizard";
} else {
    computerChoice = "spock";
}



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

alert("The computer chose " + computerChoice);





if(computerChoice == userChoice){
    alert("It's a tie");
}else if(choices[userChoice] === undefined){
    alert("You have chosen poorly! ");
}else{
    userChoice = choices[userChoice];    
    
    var victory = userChoice.defeats[computerChoice] !== undefined;
    computerChoice = choices[computerChoice]
    
    if(victory) {        
        alert("Vitory! " + userChoice.name + " " + userChoice.defeats[computerChoice.name.toLowerCase()] + " " + computerChoice.name + "!") 
    }else{
        alert("Defeat! " + computerChoice.name + " " + computerChoice.defeats[userChoice.name.toLowerCase()] + " " + userChoice.name + "!");
    }   
}