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.
The if statement is not needed. You can just return the result of the comparison.
Effectively what you are doing is:
if condition {
return true
else {
return false
}
This can be simplified to: return condition
This is a very inefficient solution. It requires an extra package, and does a lot of unnecesary string processing.
How?
The newWord variable isn't needed.
The explicit cast also isn't needed, and it is implicit from the defined return type.
The contents of the string is irrelevant.
you could just return remainder1 != remainder2
The comparison of the two values already returns a boolean type.
You are doing:
if true { return true }
return false
You could just do: return conditional-operation
This comment is hidden because it contains spoiler information about the solution
Yes, if you imagine the answer to be [x, y] then the result given must be the one with the lowest value of y.
Yes, it is very efficient, logical and clear.
It fits in with the functional aspects of JavaScript. Why wouldn't it be one of the best practices?
This comment is hidden because it contains spoiler information about the solution