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.
Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
Could you explain to me (s.length / 2 - 1) ? To me it is saying find the middle and move the index down one in case it is an even number string length so you can return both numbers. I don't get it, I do understand the deprication of substr and I used substring in my solution. Or if you could maybe explain what the (s.lenght / 2) - 1 means that will help as well.
This comment is hidden because it contains spoiler information about the solution
A string also has a length property. Don't need to convert the string to an array with
split()
.substr is deprecated
This comment is hidden because it contains spoiler information about the solution
Good code, but unnecessarily big.
No need to use Math.ceil (if you don't use decimal numbers) and ternary operator.
Check my solution.
Thanks! Mine was so ugly compared to this.
This comment is hidden because it contains spoiler information about the solution
Great solution! This is a good way for finding the middle value for sure. I will incorporate this into my code in the future!
Clever indeed
This comment is hidden because it contains spoiler information about the solution
looks cool
Because the language evolves and sometimes it's wise to stop maintaining some old features when they are replaced by newer methods, generally better. You can do easily the same thing using
slice
or (apparently, though I never used it)substring
.A different question, why substr is deprecated, seems like a good utility function?
Loading more items...