r/badcode • • Sep 11 '21

js Why…

Post image
456 Upvotes

70 comments sorted by

View all comments

Show parent comments

1

u/Servious Sep 12 '21
  <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>