Skip to content

Instantly share code, notes, and snippets.

@mohsin
Created May 3, 2020 19:40
Show Gist options
  • Save mohsin/a2ad322c3274aeac0c86b1487e3e426e to your computer and use it in GitHub Desktop.
Save mohsin/a2ad322c3274aeac0c86b1487e3e426e to your computer and use it in GitHub Desktop.
Code to calculate country-wise death percent for COVID-19 cases at https://www.worldometers.info/coronavirus/
// Run thro' browser JS console
$('#main_table_countries_today > tbody:nth-child(2) > tr').each(function(item) {
var total = parseInt($(this).children('td:nth-child(2)').text().replace(/,/g, ''), 10);
var active = parseInt($(this).children('td:nth-child(7)').text().replace(/,/g, ''), 10);
var deadCases = parseInt($(this).children('td:nth-child(4)').text().replace(/,/g, ''), 10);
var recOrDead = total - active;
$(this).append('<td>' + ((deadCases / recOrDead) * 100).toFixed(3) + '</td>');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment