Created
May 3, 2020 19:40
-
-
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/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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