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.
Nice
Twinning!
I find it quicker to type strings in template Literals/Grave Accent in my code.
Nice work!
This approach is not good. It changes the parameter if it has a falsy value, for example if an empty string were passed to firstName or lastName, it would be changed to the default value, which is incorrect. The correct way is to use default parameters.
I don't think I was aware of the default parameter feature when I solved this. If I were to solve it again I would use default parameters.
What's the benefits of this approach over the top solution?
ie. assigning fields directly inside body vs. exposing them as default paramters.
You can initialize i to 1 as a minor optimization. Adding 0 to the sum isn't necessary.