Fix for-loop solution

The main thing was moving console.log out of the for loop.

Also changed the variable declaration order, `<=` and whitespace to match the problem statement.