Last active
October 30, 2019 01:22
-
-
Save hhenrichsen/927d3cd0dad60aa67975c171df9a0e13 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
var findScores = function() { | |
return Array.from(document.querySelectorAll('span[class^=StudentPointsLabel]')) | |
.map(i => i.textContent) | |
.filter(i => i !== "" && i !== "1/1" && i !== "0/1") | |
.map(i => i.split('/').map(i => parseFloat(i))) | |
.reduce((a, i) => {a[0] += i[0]; a[1] += i[1]; return a}, [0, 0]); | |
} | |
var alertScores = function() { | |
let scores = findScores(); | |
alert(`Your score is ${scores[0]} / ${scores[1]} (${scores[0] / scores[1] * 100}%)`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment