Created
October 8, 2017 21:07
-
-
Save ericsong/2a76359255c5209645d6a49626f3a008 to your computer and use it in GitHub Desktop.
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
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