Guest User

Untitled

a guest
Jul 21st, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. // Before proceeding add an ID `target` to the table you want to perform the analysis on
  2.  
  3. // Google Chrome intercepts $ as a shortcut for document.querySelector() and
  4. // $$() as a shortcut for document.querySelectorAll()
  5.  
  6. items = []
  7.  
  8. $$('#target tr').forEach(
  9. (row) => items.push(
  10. parseFloat(
  11. $$('td p font', row)[3].innerHTML.replace(/,/g, '.'))
  12. )
  13. )
  14.  
  15. // remove header
  16. items = items.slice(1)
  17.  
  18. // average it out
  19. items.reduce((a, b) => a + b) / items.length
Add Comment
Please, Sign In to add comment