Ad
  • Default User Avatar

    Если добавить любое число в массив, он будет считать его за true. Не очень правильный подход к решению!

  • Default User Avatar

    Full on codeWARS down here, this solution looks very clean in my opinion. I'm five years late to the battle 💀, wha happened?

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Obviously you wouldn't cram an extensive and complex function into this kind of one-line solution

    I'd like to believe it's true.

  • Default User Avatar

    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.

  • Custom User Avatar

    Semantic reasons, splits into named variables for readability

    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 +, or String() 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".

  • Custom User Avatar

    > 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?

  • Default User Avatar

    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.

  • Custom User Avatar

    Wow, what a complete noob with a completely closed attitude up there!

  • Default User Avatar

    It seems to be the fastest solution.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    unreadable and confusing syntax, worst practice

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Loading more items...