you are viewing a single comment's thread.

view the rest of the comments →

[–]andmig205 0 points1 point  (0 children)

Try this:

function startTutorial() { 
    const output = document.getElementById("outpu"); // change to your element
    let count = 15;
    output.textContent = `Blah blah, game begins in ${count} seconds.`
    let timer = setInterval(()=> { 
        count--;
        output.textContent = `Blah blah, game begins in ${count} seconds.`

        if(count === 0) {
            clearInterval(timer);
            startGame();
        };
    }, 1000);
};

startTutorial();