JSFiddle - React, Tailwind, and code Playground

JavaScript

//set up data
var race = {
        horse1:{
            speed: 0,
            energy: 0
        },
        horse2:{
            speed: 0,
            energy: 0
        },
        horse3:{
            speed: 0,
            energy: 0
        },
        horse4:{
            speed: 0,
            energy: 0
        },
        horse5:{
            speed: 0,
            energy: 0
        },
        horse6:{
            speed: 0,
            energy: 0
        },
        round: 1,
        horses: [],
    	money: 500,
		bet:{
			horse: 1,
    		amount: 100
		}
}
//randomize horse speeds (keep energy at 0)
race.horse1.speed = Math.floor(Math.random()*10)+1;
race.horse2.speed = Math.floor(Math.random()*10)+1;
race.horse3.speed = Math.floor(Math.random()*10)+1;
race.horse4.speed = Math.floor(Math.random()*10)+1;
race.horse5.speed = Math.floor(Math.random()*10)+1;
race.horse6.speed = Math.floor(Math.random()*10)+1;
//main loop
function startRound(){
	//get horses
    race.horses = [];
    race.horses[0] = Math.floor(Math.random()*6)+1;
    race.horses[1] = Math.floor(Math.random()*6)+1;
    while(race.horses[1]==race.horses[0]){
    	race.horses[1] = Math.floor(Math.random()*6)+1;
    }
    race.horses[2] = Math.floor(Math.random()*6)+1;
    while(race.horses[2]==race.horses[1]|race.horses[2]==race.horses[0]){
    	race.horses[2] = Math.floor(Math.random()*6)+1;
    }
    race.horses[3] = Math.floor(Math.random()*6)+1;
    while(race.horses[3]==race.horses[0]|race.horses[3]==race.horses[1]|race.horses[3]==race.horses[2]){
    	race.horses[3] = Math.floor(Math.random()*6)+1;
    }
    alert("It is round " + race.round + ".");
    race.bet.horse = prompt("Which horse do you bet on?\nAvailable horses this race: " + race.horses + ".");
    race.bet.amount = prompt("How much do you bet on horse #" + race.bet.horse + "?\nYou have: $" + race.money + ".");
	while(race.bet.horse != race.horses[0]&race.bet.horse != race.horses[1]&race.bet.horse != race.horses[2]&race.bet.horse !=...