I'm trying to combine various code so I want to declare the start of i
ahead of time.
OLD
var i,
max_i = 4;
for (i = 2; i<= max_i; i += 1)
{
//things
}
NEW
var i = 2,
max_i = 4;
for (; i<= max_i; i += 1)
{
//things
}
The problem is that I am getting various errors in JSLint
- Expected ')' and instead saw '<='.
- Expected ';' and instead saw 'i'.
- Expected '{' and intead saw 'max_i'.
The code executes fine in both cases.