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.
From the description: "Your function can modify the initial board value as much as you like, but the test suite will validate what you return, so don't forget to return it".
But if you modify rows of the initial board then you will not pass tests. Tests call the user solution with a shallow copy of
board
.It's not mentioned in the description that once two tiles are merged, no other tiles can be merged into that same tile within the same move. This only becomes apparent from test cases.
Set
is a native class. You should not redefine it.User-defined classes ( ie, Constructor functions ) should, by convention, have names starting with a capital letter.
Expecting "falsy" for
null
,undefined
andNaN
but notfalse
,0
or""
feels inconsistent. Easiest fix for that is possibly a different name, though I have trouble coming up with one that would naturally not include any of the others. Maybe you should just go with JS itself and expect"null"
( not the historically correct bug that is"object"
! ),"undefined"
and"number"
.