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
Normally I'd say yes, giving
parseInt
a radix of 10 is best form. However, you really only have to worry about specifying a radix if the string could possibly have a leading"0x"
or"0"
. E.g.Both of those are impossible in this case: we know that the string is a number in string form and the digits are sorted in descending order, so it can't possibly begin with
"0x"
or"0"
(unless the number is 0, and then the radix is irrelevant).I prefer
+n
anyway in most cases, because you can test that the result isn'tNaN
.parseInt
andparseFloat
provide no error handling whatsoever.This comment is hidden because it contains spoiler information about the solution