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.
Cool!
this is dark magic
nice
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.
Cool solution! You can also store the number of terms on a variable to make the return statement more concise. Also, min and max can be const since they aren't changed/reassigned.
Iterate 2 times unnecessarily causes the script to be more inefficient...
Using less lines of code does not mean writting good code...
Ooops, killed my solution!
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.
It would iterate over string two times. It's an easy solution, but strange that it's rated as best.
nah bro
see my solution
isn't it an efficient way to store the sqrt result in a variable rather than doing it twice?
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()
.gg
notice he had put a comma at the end of the first statement that indicates that his statement is not finished yet so the browsers knows that let is used for the secind line too
Loading more items...