Mind boggling javascript failure at handling some basic addition!
<p>This is killing me! I'm trying to add the values of four fields together, and I get allllll kinds of wierd results!</p>

<p><strong>The code I have so far:</strong></p>

<pre><code>$('input.percent').change(function() {
    var totalup = 1;
    var totalup = totalup*1;
    $('input.percent').each(function(){
        var current = $(this).val();
        var curvalue = current * 1;
        console.log(curvalue);
        console.log(totalup);
        var totalup = curvalue + totalup;
    });
});
</code></pre>

<p>This should be ungodly simply. Start with a value of zero, get the value of each input, add it to that totaling value. The console log always shows UNDECLARED or NaN for totalup, but if I remove the last decleration of totalup (where it adds more to totalup) it suddenly doesn't become undefined or Nan.</p>

<p>Why is this not ungodly simply!!! I must be missing something dumb, or Javascript just STINKS!</p>

<p>Thanks in advance for your help!</p>
