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.
then this guy only completed 7 Katas lol. how ironic
Because some people (icluding me) didn't knew about .replace.
It's not bad practice. It's just different approach taking into consideration the performance of the solution.
try to figure it out why paj :D
I think the same can be done like this:
return root%1 ? -1 : Math.pow(++root, 2);
since root%1 would return a non zero value (i.e. it's remainder) if it not completely divisible.
Indeed a clever and cool idea. :)
This comment is hidden because it contains spoiler information about the solution
why use switch/if conditions if Javascript has already functions like .replace(), .split() .map() .join() etc, which can reduce the number of lines you code? Indeed a bad practise.
Wow! I thought competitive programming makes use of less codes. Why don't you StackOverflow to see if such function already exists in JS, which can reduce 96% of the code you wrote? I swear this to be a bad practise.
Thanks for explaining @user4202879
You need not take 2 variable of same identifier
s
.