As a separate issue, declaring variables within the for loop does not restrict them to there. JavaScript does not have block scope. There is only function scope that currently applies to JavaScript. This means that wherever a variable is declared, that declaration is automatically hoisted to the top of the function.

Because it can be confusing for what you have written to differ from what actually occurs, it's a best-practice to declare all of the variables from one var statement right at the start of the function that they are in. In this case you have no functions, so it's just right at the start instead.

Caching the loop length also does not provide any significant improvement, but if you were to do it then it could be done in the following manner:

Btw is there any difference doing thisor (i = 0; i < urlsLen; i += 1)instead of or (i = 0; i < urlsLen; i ++)

Not directly, but it has benefits later on.

It means that if you need a loop to increase by 2, or by some other value (returned from a function perhaps) then the i += 1 version is easier and more consistent to modify.

The other reason that I have for staying away from ++ is that it doesn't improve, the code or make it faster, or easier to understand, or to modify. So, since ++ provides no realistic benefit - I consider it to to not be a useful part of JavaScript.

It's not directly harmful, but it does have the potential to harm when used in other places instead of clearer techniques.So my personal standard is to not use ++, which also prevents me from being tempted use it in other parts of the code in potentially confusing ways.