I have a situation like:
for(var i = 0; i < a + b; ++i)
Do I have to worry about the addition being done at each iteration? Or is JavaScript (its parser?) Smart enough to understand what a + bis a constant?
In other words, should I do this as follows:
var end = a + b;
for(var i = 0; i < end; ++i)
or will this lead to the cancellation of a line of code?
Well, actually what I'm worried about is not just one line of code, but the fact that I think about it every time I come across a similar situation in JavaScript! In addition, today it is an addition, tomorrow it may be something else, like the square root of it, so I consider it important!