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.
Closures are a common technique for preventing access on object properties. This causes your random tests to fail as they expect read access to
ticket.code
andticket.used
.I think you need to be clearer about this in the description.
The original format is a small optimisation, the length of the array is calculated once up front rather than on every loop iteration.
FYI
.reduce()
allows you to define an initial value for empty arrays:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce