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.
Good Question, i have no clue anymore.
I guess it was at the time i wanted to learn a bit more about Linq
and tried to solve a lot with usage of Linq
Guess they just copied the 'best practice'
Modified the starting code to be more beginner-friendly and less repulsive.
I think using properties of the object (result-array) is much more obvious and understandable by other developers. There is no risk of changes of the length after creating the array (and if it would change you wouldn't have the threat of missing it), where 'n' could be used for something else in between the array creation and the population of the array.
Or more generally, for any object that has
length
property.As for mappability, it depends on what you consider mappable.
Array.prototype.map
works on strings.Functional tools like
map
are very standard now and should be familiar to anyone using the language seriously. The only part of this answer that is tricky is the use ofsplit('')
, but this is a pretty common trick for getting an array of characters (as Javascript unfortunately won't treat strings as mappable collections).join
is used in a plain way. The implicit conversions from string to int are a little weird.