Preventing concatenation
<p>I've been writing JavaScript on and off for 13 years, but I sort of rediscovered it in the past few months as a way of writing programs that can be used by anyone visiting a web page without installing anything.  See <a href="http://ab1jx.webs.com/calcs/calcs.html" rel="nofollow">http://ab1jx.webs.com/calcs/calcs.html</a> for example.</p>

<p>The show stopper I've recently discovered is that because JavaScript is loosely typed by design, it keeps concatenating strings when I want it to add numbers.  And it's unpredictable.  One routine worked fine for several days then when I fed different data into it the problem hit and I ended up with an impossibly big number.</p>

<p>Sometimes I've had luck preventing this by putting <code>( )</code> around one term, sometimes I've had to resort to <code>parseInt()</code> or <code>parseFloat()</code> on one term.  It reminds me a little of trying to force a float result in C by putting a .00 on one (constant) term.  I just had it happen when trying to <code>+=</code> something from an array that I was already loading by doing <code>parseFloat()</code> on everything.</p>

<p>Does this only happen in addition?  If I use <code>parseInt()</code> or <code>parseFloat()</code> on at least one of the terms each time I add, will that prevent it?  I'm using Firefox 6 under Linux to write with, but portability across browsers is also a concern.</p>
