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.
Merge pull request #30 from hubgit/patch-2

Fix for-loop solution