Created
December 8, 2018 16:56
-
-
Save gouf/088187e15f98509d685fec64a204c15e to your computer and use it in GitHub Desktop.
Amazon の欲しいものリストから総額を取得 (簡易版)
This file contains 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
(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