I need help in my code by the way its a typing game that has timer and a life and a scoreboard im also a beginner in JavaScript my problem here is i want to snuffle again the word after the user got the answer correct or got the wrong answer sorry for my english
var words = ["PRINTF","SCANF","GETCH","MAIN"];
var life;
var seconds;
var temp;
var score=0;
//Timer
function countdown() {
seconds = document.getElementById('countdown').innerHTML;
seconds = parseInt(seconds, 10);
if (seconds == 0) {
temp = document.getElementById('countdown');
alert("TIME IS UP!");
document.getElementById("countdown") = 0;
}
seconds--;
temp = document.getElementById('countdown');
temp.innerHTML = seconds;
timeoutMyOswego = setTimeout(countdown, 1000);
}
//Random
var getRandomWord = function () {
return words[Math.floor(Math.random() * words.length)];
}
var word = getRandomWord();
//Display
function start(){
document.getElementById("display").innerHTML = word;
}
// Validate the entered word
function go() {
var input = document.getElementById("demo").value;
var input1 = input.toUpperCase();
if (word==input1){
alert('Correct');
score=score+1;
document.getElementById("score").innerHTML = score;
start();
}
else
{
alert('Wrong');
start();
life = document.getElementById('life').innerHTML;
life = parseInt(life);
life = life-1;
document.getElementById("life").innerHTML = life;
}
}
<body onLoad = "countdown(); start();">
Time: <span id="countdown" style="font-weight: bold;">11</span><br>
Life: <span id="life" style="font-weight: bold;">3</span><br>
Score:<span id="score" style="font-weight: bold;">0</span><br>
WORD: <span id="display"></span>
<section id="f1">
<input type="text" id="demo" onkeydown="if (event.keyCode == 13) go();" >
</section>
</body>