The ListenHear Game - Listen and type the word What it does:

Speak a random word chosen from an array and ask the user to type the word in the box for 15 seconds


If right, +1pts, reset the timer and go to next word.
If wrong: do nothing.
After 15 seconds: game over.




    body {background-color: black; color: white;}
    .center {
      width: 50%;
      height: 50%;
      position: absolute;
      top:0;
      bottom: 0;
      left: 0;
      right: 0;

      margin: auto;
    }
    .hidden {
      display: none;
    }
&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"&gt;&lt;/script&gt;
&lt;center class="center start"&gt;
  &lt;h1&gt;
    The ListenHear&lt;br&gt;Game&lt;br&gt;&lt;br&gt;&lt;button class="w3-btn w3-green" onclick="play()"&gt;Play&lt;/button&gt;&lt;button class="w3-btn w3-red" onclick="exit()"&gt;Exit&lt;/button&gt;
  &lt;/h1&gt;
&lt;/center&gt;
&lt;center class="center hidden"&gt;
  &lt;h1 id="x"&gt;&lt;x class="w3-red"&gt;There was an error.&lt;/x&gt; &lt;/h1&gt;
&lt;/center&gt;
&lt;script&gt;
var read;
var time = 0;
var i = 0;
var words;
var c;
  $.getJSON( "https://gist.githubusercontent.com/khanh2003/ae6c144ed12aa4e6dce98c40163935d1/raw/9073f8a40a39ecbe02a38547f99bca9e3637660c/JSON.json", function( data ) {
    words=data;
    });
function play() {
$(".start").hide(function() {
$(".hidden").removeClass("hidden");
$("#x")[0].innerHTML = "&lt;i style='color:green'&gt;Listen and fill in the blank the word(s).&lt;/i&gt;";
setTimeout(game,2000);
});}
function game() {
  read = words[Math.floor(Math.random()*words.length)];
  $("#x")[0].innerHTML = "&lt;input type=text onkeypress=check() style=width:100%&gt;&lt;/input&gt;&lt;button onclick='speechSynthesis.speak(new SpeechSynthesisUtterance(read));'&gt;Again please!&lt;/button&gt;&lt;br&gt;&lt;div class='time'&gt;&lt;/div&gt;&lt;br&gt;&lt;button onclick=giveup()&gt;Give up&lt;/button&gt;";
$("input").focus();
speechSynthesis.speak(new SpeechSynthesisUtterance(read));
time = 0;
  c=setInterval(function() {
  time=time+0.01;
  $(".time").text(Math.floor(15-time));
  if(time&gt;15) {giveup();}
}, 10);
}
function check() {
  
  if ($("input")[0].value.toUpperCase() === read.toUpperCase()) {
    $("#x")[0].innerHTML = "&lt;i style='color:green'&gt;Correct! Score: "+(++i)+"&lt;/i&gt;";
    time = 0;
    setTimeout(game,2000);
    clearInterval(c);
  }
}
function giveup() {
    $("#x")[0].innerHTML = "&lt;i style='color:red'&gt;Time's Up! Score: "+(i)+"&lt;br&gt;The word(s) are: "+read+"&lt;/i&gt;";
    time=0;
    setTimeout(play,5000);
}
function exit() {$("body").slideUp(function() {window.close;});}
&lt;/script&gt;




For those who are complaining the code is broken, the SpeechSynthesisAPI (the code depends on) doesn't have good browser support.
Your game() calls c=setInterval(…), which is balanced by clearInterval(c) in check().  However, giveup() does not call clearInterval(c).  As a result, if you just start the game but do nothing, then it gets ridiculously faster and faster.