I'm trying to write an equation within a sum loop and everything works fine by the use of an addition sign +, which I'm assuming is confusing the incrementing of the sum loop. The value should be 56 for the equation but actual output is a string of 095959595.
The code looks like this:
$(function () {
var feature = $('.product');
var supplier = $('#supplier').val();
var costCurve = $('#productCostCurve').val();
var baseCost = $('#baseComponentCost').val();
var unitCost = 0;
$.each(feature, function () {
unitCost += (costCurve * parseFloat($(this).val()) * baseCost * supplier) + baseCost;
});
$('#product-cost').html(unitCost);
});