break while loop before negative number
<p>Im trying to break a while loop before it goes into the negative numbers but it keeps going past 0 and showing a negative numbers </p>

<p>The problem would be my while loop this is the loop</p>

<pre><code>while(Math.round(housetotal)&gt;0){
    housetotal-=o*12;
    zx++;
    row_data.push([zx,
    {v:housetotal, f:'$'+Comma(housetotal)},        
    ]);

    if(zx == year || housetotal&lt;=0){                 
            break
        }

    }
</code></pre>

<p>my loop works something like this.</p>

<p>lets say </p>

<pre><code>housetotal = 239,852 
o = 1,438
</code></pre>

<p>222,596 and continue to count down to -1,732 after 14 loops</p>

<p>im trying to make it stop at the 13th loop which is 15,524 so it doesn't go into the negative</p>

<p>in my while statement i have if zx which is equal to whatever number i have which in this case is 15 and o*12 is whatever number that comes up multiplied by 12 but in this case is 1,438 x 12 = 17,256</p>
