Last active
August 29, 2015 14:24
-
-
Save prakhar1989/9be9bf255d6c11a17d1f to your computer and use it in GitHub Desktop.
Get surnames of MS CS students at CU
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
// Before you run this code, add the id `ms` to the masters students HTML table | |
Array.from( | |
[].slice.call(document.querySelectorAll("table#ms tr")) | |
.map((tr) => tr.children[0].innerText.split(",")[0]) | |
.reduce((acc, x) => { | |
acc.has(x) ? acc.set(x, acc.get(x) + 1) : acc.set(x, 1) | |
return acc; | |
}, new Map()) | |
).sort(([valA, countA], [valB, countB]) => { | |
if (countA > countB) return -1; | |
else if (countA < countB) return 1; | |
else return valA > valB; | |
}).filter((_, i) => i < 10).forEach((x) => console.log(x)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Class of 2015-2016 and 2014-2015
source