Skip to content

Instantly share code, notes, and snippets.

@ericsong
Created October 8, 2017 21:07
Show Gist options
  • Save ericsong/2a76359255c5209645d6a49626f3a008 to your computer and use it in GitHub Desktop.
Save ericsong/2a76359255c5209645d6a49626f3a008 to your computer and use it in GitHub Desktop.
function getPercentageFromA(a) { return parseInt(($(a.getAttribute('data-content')).find('div')[0].innerHTML).split('%')[0]); }
function getAveragePercentage() {
var total = 0;
var count = 0;
for (var a of $('.lattice-single-character ul li a')) {
var percentage = getPercentageFromA(a);
if (!isNaN(percentage)) {
total += percentage;
count++;
}
}
return total / count;
}
getAveragePercentage();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment