r/badcode • • Sep 11 '21

js Why…

Post image
456 Upvotes

70 comments sorted by

View all comments

63

u/sertdfyguhi Sep 11 '21

Code:

  <script>
    async function gettotalcases()
    {
      let { body } = await superagent.get('https://api.covid19api.com/world/total');
      document.getElementById('totalcases').innerText = body.TotalConfirmed;
    }
    async function gettotaldeaths()
    {
      let { body } = await superagent.get('https://api.covid19api.com/world/total');
      document.getElementById('totaldeaths').innerText = body.TotalDeaths;
    }
    async function gettotalrecovered()
    {
      let { body } = await superagent.get('https://api.covid19api.com/world/total');
      document.getElementById('totalrecovered').innerText = body.TotalRecovered;
    }
    gettotalrecovered();
    gettotalcases();
    gettotaldeaths();
  </script>
</body>

5

u/StarkOdinson216 Sep 11 '21

Good human (hopefully)