Skip to content

Instantly share code, notes, and snippets.

@mintchaos
Last active January 4, 2018 01:09
Show Gist options
  • Save mintchaos/676953453d43b06d1cb353fd4c161ba7 to your computer and use it in GitHub Desktop.
Save mintchaos/676953453d43b06d1cb353fd4c161ba7 to your computer and use it in GitHub Desktop.
// Find all of the boxes with totals
$$('.wht_total')
// Take off the $ and turn it into a number (instead of a word made out of digits)
.map(el => Number(el.innerText.slice(1)))
// Remove any that aren't numbers (the "Total" at the top is included)
.filter(n => !isNaN(n))
// Add everything together
.reduce((t, c) => t+c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment