How to prevent values from being converted to strings in javascript?
<pre><code>    var str;
    var displayedNum;
    for (i in imgURLArray){
        str = "&lt;li photonum="+i+"&gt;" + "&lt;a&gt;"+ (1+i) + "&lt;/a&gt;" + "&lt;/li&gt;";
        $("ul.selection-list").append(str);

}
</code></pre>

<p>I need to do this within a loop, but what happens is it prints out "11" instead of "2", because it converts to string before addition.</p>

<p>I have the same problem if I try to do the addition outside of the string and store in a variable as well, it still converts to string instead of doing addition.</p>

<p>Number(1+1) still converts to string first before turning it into a number, so it comes out 11.</p>
