Skip to content

Instantly share code, notes, and snippets.

@wtoalabi
Created June 2, 2020 15:17
Show Gist options
  • Save wtoalabi/351d800d257fef5db1b63983b043c5d5 to your computer and use it in GitHub Desktop.
Save wtoalabi/351d800d257fef5db1b63983b043c5d5 to your computer and use it in GitHub Desktop.
let t = document.querySelector("table tbody")
let tr = t.querySelectorAll("tr td[align]=right")
arr = []
tr.forEach(function(d){
if(d['align'] === 'right'){
let countString = d['innerHTML']
if(typeof countString === 'string'){
let split = countString.split(",")
let joined = split.join("")
let count = Number.parseFloat(joined)
arr.push(count)
}
}
})
arr.reduce((a,b)=>a+b,0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment