Skip to content

Instantly share code, notes, and snippets.

@itsazzad
Last active February 7, 2022 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsazzad/d9da4dbce2a03a812b5dc1549a12b76a to your computer and use it in GitHub Desktop.
Save itsazzad/d9da4dbce2a03a812b5dc1549a12b76a to your computer and use it in GitHub Desktop.
medex.com.bd
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