0

I have this code with Javascript

function wait(ms) {
    var d = new Date();
    var d2 = null;
    do { d2 = new Date(); }
    while (d2 - d < ms);
  }

fetch('https://api.covid19api.com/dayone/country/xxx')
          .then(response => response.json())
          .then((data) => {
            data.forEach(row => {
              // console.log(row);

              let Confirmed = parseInt(row.Confirmed);
              let Chamal = Confirmed * 1 / 100;
              var local_date = moment.utc(row.Date).local().format('YYYY-MM-DD');
              console.log(Chamal);
              document.getElementById('text_1').textContent = Chamal;
              wait(10);
            });
          });

I want to display the value 'Chamal' on each loop, the 'text_1' is a simple text. this works only on console. I want the display to be like a counter, any help please ?

Fray
  • 250
  • 2
  • 5
  • 16

0 Answers0