JSFiddle - React, Tailwind, and code Playground

by InferOn

JavaScript

function message(dest) {

if(dest===5) 
    window.setTimeout(alert, 5000, "Great start.");

else if (dest===134) {
    window.setTimeout(alert, 3000,"You made it.");
    window.setTimeout(MyConfirm, 5000);
    
   
}
}

function MyConfirm(){
    if(confirm("Game over. Do you want to play again?"))
        reset();
    else
        noReset();
}

function reset(){alert('reset');}
function noReset(){alert('no reset');}

message(134);