Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let fileVotes = document.getElementsByTagName('pre')[0].textContent.split('\n').filter(String)
- function countVotesForCandidate(id) {
- return fileVotes.reduce((accumulator, currentValue) => accumulator + Number(currentValue.split('SEL=')[1].split(' K1')[0].split(',').includes(id.toString())), 0)
- }
- let results = {}
- for (i = 1; i <= 34; i++) {
- results[i] = countVotesForCandidate(i)
- }
- console.table(results)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement