Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tronghieu60s/0a4fef1fac38368c6c9bf64ed6b4a0f8 to your computer and use it in GitHub Desktop.
Save tronghieu60s/0a4fef1fac38368c6c9bf64ed6b4a0f8 to your computer and use it in GitHub Desktop.
lấy đơn vị tiền tệ tiếng việt tại trang https://wise.com/vn/currency-converter/currencies
Array.from(document.querySelectorAll('div[aria-label="currency-group"] a')).map(item => ({currency: item.querySelector("h5").innerText, name: item.querySelector("p").innerText, flag: window.getComputedStyle(item.querySelector(".currency-flag")).getPropertyValue('background-image').slice(4, -1).replace(/"/g, "")}))
@tronghieu60s
Copy link
Author

Filter support currency in js Intl

Array.from(document.querySelectorAll('div[aria-label="currency-group"] a')).map(item => ({currency: item.querySelector("h5").innerText, name: item.querySelector("p").innerText, flag: window.getComputedStyle(item.querySelector(".currency-flag")).getPropertyValue('background-image').slice(4, -1).replace(/"/g, "")})).filter(item => Intl.supportedValuesOf('currency').includes(item.currency))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment