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.
illegal, because null transform to empty str
Wrong. Here is the condition:
flatten('a', ['b', 2], 3, null, [[4], ['c']]) // returns ['a', 'b', 2, 3, null, 4, 'c']
This solution converts any item to string, so
flatten('a', ['b', 2], 3, null, [[4], ['c']])
returns['a', 'b', '2', '3', '', '4', 'c']
Maybe it's easier to imagine
x = [];
, thenx.slice()
. Or even([]).slice
. In all cases, it looks on the instance of the array for theslice
method and, failing to find one, walks the prototype chain until it gets there. Hypothetically less performant but it's a constant time optimization and I think some or most compilers optimize for the autoboxing this involves.