SHARE
TWEET

Count NABU votes

olegsuv May 29th, 2020 1,083 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let fileVotes = document.getElementsByTagName('pre')[0].textContent.split('\n').filter(String)
  2.  
  3. function countVotesForCandidate(id) {
  4.     return fileVotes.reduce((accumulator, currentValue) => accumulator + Number(currentValue.split('SEL=')[1].split(' K1')[0].split(',').includes(id.toString())), 0)
  5. }
  6.  
  7. let results = {}
  8. for (i = 1; i <= 34; i++) {
  9.   results[i] = countVotesForCandidate(i)
  10. }
  11. console.table(results)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top