Skip to content

Instantly share code, notes, and snippets.

@ChrisMBarr
Created August 1, 2012 20:42
Show Gist options
  • Save ChrisMBarr/3230548 to your computer and use it in GitHub Desktop.
Save ChrisMBarr/3230548 to your computer and use it in GitHub Desktop.
Total up the cost of all items in an Amazon wishlist
var list = $$("#item-page-wrapper .list-items table tbody .lineItemMainInfo .lineItemPart strong");
var total=0;
for(i=0; i<list.length;i++){
total += parseFloat(list[i].innerText.replace("$",""));
}
alert(list.length+" items for a total of: $"+total.toFixed(2));
@s0kil
Copy link

s0kil commented May 20, 2021

Latest Version:

$$('.a-price').map(_ => _.firstChild.innerText.replace('$', '')).map(_ => parseFloat(_)).reduce((a, v) => a + v)

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