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.
This comment is hidden because it contains spoiler information about the solution
I think as far as "best practices" are concerned, it's what the code actually does that matters when voting, not the actual style of code employed when writing the solution.
I don't think people are marking submissions as "clever" because someone deleted whitespace/newlines and shortened 3 lines of code into 1, they're voting "clever" because what the code is doing is clever - regardless of syntax, style and other cruft. It just so happens that in a lot of cases, particularly these easier problems, "clever" solutions consist of one line. In addition a lot of people seem to be going for code golf, though there's no benefit of doing that.
In an actual codebase I think that, while most people would spread this snippet of code out, it would nonetheless be considered "best practice".
This comment is hidden because it contains spoiler information about the solution
Array(number)
will give you an array of numberundefined
's, so you have to add one since the "hue" is really the glue between them.As stated in the description, if the property doesn't exist, the output array should contain
undefined
in its place.Apparently we should not be checking if the property exists?