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.
that function thing is making it look so hard.
Full on codeWARS down here, this solution looks very clean in my opinion. I'm five years late to the battle 💀, wha happened?
This comment is hidden because it contains spoiler information about the solution
I'd like to believe it's true.
In the context of a function that can be expressed as a very short chain of basic methods, I think this syntax is fine and readable.
Obviously you wouldn't cram an extensive and complex function into this kind of one-line solution, but all THIS function needs to do is apply a few methods to a single argument and return it. Perfect use-case for shorthands if there ever was one. If we're worried about who else has to read and work with the code, giving each method its own line would resolve that well enough.
This depends on the reason you're writing code. It's your job/homework, and other people will have to work with your code or review it? Of course, it's a good idea to split stuff into variables (better readability). But there's no reason why you absolutely must use self-explaining constructs (like
Number()
instead of+
, orString()
instead of+""
) because you can still explain everything with comments.On the other hand, if all you do is complete a small task on a competitive programming website, there's no reason to stretch everything into as many lines as possible and write "100% understandable code"; on the contrary, you're doing lots of useless work because "newbies may not understand some interesting language features because they've never encountered any code using those because everybody writes in the same dull pre-ES6 manner".
> Writes a 1-line solution but splits it into 5 lines because reasons
> Talks about how 1-line solutions are evil
How is your code any better?
Please learn how to write readable code w/o one liners hacks and stop talking about closed attitude when you have one yourself.
I know JS but it doesn't matter, this code still looks like a mess.
Wow, what a complete noob with a completely closed attitude up there!
This comment is hidden because it contains spoiler information about the solution
unreadable and confusing syntax, worst practice
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Loading more items...