Last active
January 12, 2023 04:40
-
-
Save F0urO4/cfde1fed4d43affdc175bf56ee32a87d to your computer and use it in GitHub Desktop.
average ebay price
This file contains hidden or 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 getItems = () => Array.from(document.querySelectorAll('.srp-river-results .s-item__price')); | |
var getPrices = () => getItems().map((item) => parseFloat((item.textContent.match(/\d+.\d+/)[0]))); | |
var sum = () => getPrices().reduce((a, b) => b + a, 0 ); | |
var getAvg = () => sum() / getPrices().length; | |
console.log(getAvg().toFixed(2)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I used aalvarado's code but it was giving me an error. I've updated it now.