JSFiddle - React, Tailwind, and code Playground

by Tilwin Joy

HTML

<input type="button" value=" YES " onclick="yes()" />

JavaScript

c = 5;

function yes() {
    alert("Right");
    var ans = 0;
    while (ans == 0) {
        var x = prompt("Your Name?");
        var ans = confirm("Your Name is " + x + " right?");
    }
    document.body.innerHTML+= '<h1>Welcome ' + x + ' </h1><p id="show">You are being redirected in 3 seconds</p>';
function updateShow() {
    document.getElementById('show').innerHTML = "<h1>You are being redirected in " + c + "     seconds</h1>";
    c = c - 1;
    if (c < 0) {
        document.location = '2.html';
    } else {
        setTimeout(function () {
            updateShow();
        }, 1000);
    }
}

    var iAmTimer = setTimeout(function () {
        updateShow();
    }, 1000);
}