Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Performs basic analysis on a random table found in a webpage using basic JS
// Before proceeding add an ID `target` to the table you want to perform the analysis on
// Google Chrome intercepts $ as a shortcut for document.querySelector() and
// $$() as a shortcut for document.querySelectorAll()
items = []
$$('#target tr').forEach(
(row) => items.push(
$$('td p font', row)[3].innerHTML.replace(/,/g, '.'))
// remove header
items = items.slice(1)
// average it out
items.reduce((a, b) => a + b) / items.length
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment