Created
April 24, 2020 13:21
-
-
Save briandipalma/d71e7b23eff4b0d71abd61c2cf5dc02b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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