Respuesta :

Answer:

Some parts of your question is missing here is the missing part

var count = 0;

var counterElement = document.getElementById("counter");

counterElement.innerHTML = count;

Answer : var interval = setInterval(function () {

   count++;

   counterElement.innerHTML = count;

   if (count === 5) {

       clearTimeout(interval);

   }

}, 300);

Explanation:

var interval = setInterval(function () {

   count++;

   counterElement.innerHTML = count;

   if (count === 5) {

       clearTimeout(interval);

   }

}, 300);