Last active
February 7, 2022 21:11
-
-
Save itsazzad/d9da4dbce2a03a812b5dc1549a12b76a to your computer and use it in GitHub Desktop.
medex.com.bd
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
const average = (array) => array.reduce((a, b) => a + b) / array.length; | |
var packages = document.querySelectorAll("tr:not(.hidden) .package-container") | |
const prices = []; | |
for (let i = 0; i < packages.length; i++) { | |
const pack = packages[i].innerText; | |
prices.push(Number(/৳\s([^\s(]+)/.exec(pack)[1])) | |
} | |
const min = Math.min(...prices); | |
const max = Math.max(...prices); | |
const avg = average(prices); | |
console.log({ min, max, avg }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment