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.
Contrary to vincaslt's comment, I believe n is necessary in order to catch the condition vectorjohn points out.
In this case it not only copies the array so it isn't modified (a best practice) but also handles when n is less than 3. Without it he'd return the whole signature.
It just creates a copy of an array, so that actual argument is not mutated. n could be ommited here, without change, making this less confusing.
Love the code. Cannot for the life of me wrap my head around the need for "const result = signature.slice(0, n);" at the beginning. I keep running through it, and seeing the different results with and without it, but cannot see why it does so. Could you clarify?