Skip to content

Instantly share code, notes, and snippets.

@MorrisJobke
Created February 8, 2017 18:27
Show Gist options
  • Save MorrisJobke/49fdfa601a1a4a080f202c0b83bb434e to your computer and use it in GitHub Desktop.
Save MorrisJobke/49fdfa601a1a4a080f202c0b83bb434e to your computer and use it in GitHub Desktop.
Sum up some values
$('[field="amount_usdollar"]')
.map(function(index, value){
return $(value)
.text()
.trim()
.replace(',', '')
.replace('€','');
})
.toArray()
.map(function(value){
return parseFloat(value);
})
.reduce(function(a, b){
return a + b;
}, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment