Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
For this specific instance, its completely arbitrary. Doesn't make one difference.
There is a difference if you are wondering though. In the solution, he uses a pre-increment rather than a post increment like in your question. It increments the number before the statement executes. It doesn't make a difference because the only thing in that statement is '++i'. Here's an example of it:
FUN FACT: There is another difference but I'm not sure it applies to Javascript, but in C++ my professor once told me that, in a for-loop, pre-increments are much more efficient, and that big data companies always use pre-increments when applicable because of that. Could be the reason why its used here, I know I use it because of that fact lol.
Can someone explain why this wouldn't be used compared to other strategies?
It's probably just because of the context of the question.
Like if someone asked "Hey how do I do this thing in Python?" you wouldn't answer "Well in C++ you can do it like this..."
So in this case, a function with a passed in parameter is given to you, might as well give the solution in the way it was already structured.
Though I do agree that overall, the best practice for legibility in Javascript would be having the solution as a variable function.