Skip to content

Instantly share code, notes, and snippets.

@gouf
Created December 8, 2018 16:56
Show Gist options
  • Save gouf/088187e15f98509d685fec64a204c15e to your computer and use it in GitHub Desktop.
Save gouf/088187e15f98509d685fec64a204c15e to your computer and use it in GitHub Desktop.
Amazon の欲しいものリストから総額を取得 (簡易版)
(new Intl.NumberFormat('ja-JP', {
style: 'currency',
currency: 'JPY'
})).format(
Array.from(document.querySelectorAll('span.a-price-whole').values())
.map(function(v) { return v.innerText })
.map(function(v) { return parseInt(v.split(',').join('')) })
.reduce(function(ret, v) { return ret + v })
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment