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 solution only works due to incomplete testing. It checks whether a is truthy. Here are some possible falsy cases in JavaScript:
false,
null,
0,
NaN,
"" (empty string),
undefined
So if you have any value other than these, such as a string like "abc" or simply the boolean true, this function wouldn’t work.
Additionally, even though this is a function expression, which is good practice, you should use the const keyword. Not using it is considered bad practice. And don’t forget the semicolon at the end.
Not entirely true since null or an empty array are falsy. Though when you get a string or a number other than 0, those are truthy. Or what if you have a variable with "true" as its value? Your solution is correct though.
his solution is good to use after you check that array is valid
Нормальная ката, для 8 kyu самое оно, то что надо
mine checks for everything ofcours we need sort
You sort old array, then create new one. For what? This solution is too slow on large inputed arrays.
too much letters
Wow!
difficult to read
Holy code!
array?.length>2 yes
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
nicely done
Loading more items...