Skip to content

Instantly share code, notes, and snippets.

@mark-d-holmberg
Created February 19, 2013 17:30
Show Gist options
  • Save mark-d-holmberg/4988002 to your computer and use it in GitHub Desktop.
Save mark-d-holmberg/4988002 to your computer and use it in GitHub Desktop.
How to add numbers in javascript
updateTotalManualFeeSubTotals = function() {
var subtotal;
subtotal = 0.0;
$("td.manual-fee-sub-total").map(function() {
var value;
value = parseFloat(this.innerHTML.replace("$", ""));
if (!isNaN(value)) {
return value;
}
}).each(function(i, e) {
return subtotal += parseFloat(e) || 0.0;
});
return subtotal;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment