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.
Hi, I just tested your solution and it doesn't pass all the tests.
The point here is, when you sometimes use a
for
loop to repeatedly perform an action, if the action is identical every single time then the parameter is not needed. However, as you may be aware, in most cases, the action performed is not identical.Say, for example, you wanted to
console.log
the numbers 1 to 10 on the screen. If you didn't pass thei
parameter in, how can you possibly tell the computer to print an integer and increment by one every time? The only solution is to use the parameteri
which by definition of your for loop increments by 1 every time:Of course you could ignore the parameter
i
and introduce (and increment) an external variable, but the example above is the most direct and obvious solution.This comment is hidden because it contains spoiler information about the solution