Created
January 2, 2020 08:42
-
-
Save LeoDT/362a09f22ee6487bc6f0401b94cc89cb 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
const year = '2019'; | |
Array.from(document.querySelectorAll('.wallet_table_row')) | |
.filter(tr => { | |
return ( | |
tr.querySelector('.wht_type div:first-child').textContent === '购买' && | |
tr.querySelector('.wht_date').textContent.indexOf(year) !== -1 | |
); | |
}) | |
.map(tr => | |
tr | |
.querySelector('.wht_total') | |
.textContent.replace('¥', '') | |
.trim() | |
) | |
.reduce((s, i) => s + parseInt(i, 10), 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment