Skip to content

Instantly share code, notes, and snippets.

@a-eid
Created January 18, 2020 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save a-eid/7a8d8095957532b5bc6430e0038c07d6 to your computer and use it in GitHub Desktop.
Save a-eid/7a8d8095957532b5bc6430e0038c07d6 to your computer and use it in GitHub Desktop.
function total(){
return [...document.querySelectorAll("td.text-right")].reduce((a,b) => {
return a + parseFloat( b.innerText.replace(/[,$]/g, ""))
}, 0)
}
@a-eid
Copy link
Author

a-eid commented Jun 27, 2021

[...document.querySelectorAll("[data-qa='total']")].reduce((memo, curr) => { 
    return memo + parseInt(curr.innerText.replace('$', '').replace(',', '')) 
} ,0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment