Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var getAmount = (e) => e.querySelector(".text-right").innerText.replace("€", "");
var parse = e => parseFloat(getAmount(e));
var tbody = document.querySelector(".transactions-data-table tbody");
var entries = Array.from(tbody.children);
var amounts = entries.map(parse);
var mostRecentYearly = amounts.indexOf(110.00);
var lastYearly = amounts.indexOf(110.00, mostRecentYearly + 1);
var yearlyCharges = amounts.slice(mostRecentYearly, lastYearly);
yearlyCharges.reduce((a, v) => a + v, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment