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.
"more code" isn't a big deal if it's not increasing complexity. sure he could have perhaps used ternaries instead of if-else, but what i see at work here is the prevailing desirability of standard syntax.
lessgo
I can't answer your actual question but I can give oyu this info that I looked up on the performance of terrinary operators comapred to if statements. Terniary is better preformance wise than if statements. I think that is also a generall assumption we make when learning about terrinary operators. However I never actually understood the technical reason why. Here it is based off my google search: An if / else statement emphasises the branching first and what's to be done is secondary, while a ternary operator emphasises what's to be done over the selection of the values to do it with.
never the less your answer is amazing as well
Still too much. My solution is just as readable (if not more so) and has way less code. I'm open to see better ones but this ain't it imo
ok fine me too, we got this boys
Sometimes brute force is the way to go.
...
This might not be that time, but sometimes it is! I also used this solution.
Matter of preference. Tenery operator, at least for me, makes code more readable in most cases.
*in professional code, yes
in codegolf (crafting a solution with the fewest characters/bytes), however, anything goes
Thank you! Much appreciated.
if you omit
var
,const
orlet
, the variable is automatically attached to the global object. this is considered bad practice, howeverIf someone is still looking at old katas like this, can you explain why this doesn't need a "const"? Mine seemed to break without it.
Coercion in this way is really useful sometimes!
This comment is hidden because it contains spoiler information about the solution
I love those as well. It's so interesting. I always look up what they're about if no one explained them in the replies. It's fun to know that those fancy options exist.
Loading more items...