15

Found this gem in a popular frontend framework...

...the fuck?!

Comments
  • 5
    What am I missing here? Seems quite readable.
  • 2
    @onebit0fme Nested ternary statements.
  • 1
    I think what makes it worse is they clearly know its unreadable as they have formatted it.
  • 2
    @nblackburn Eh, it reads like sweet music to me. As it is formatted it is very readable. To say that formatting it proves it is unreadable is silly.
  • 2
    I've had to deal with some unformatted nested ternary statements in the past, it wasn't fun...
  • 1
    @iam13islucky You misunderstand my point, the point was ot needed the formatting to be readable rather than a solution that is readable.
  • 0
    What framework btw?
  • 1
    We have a clean up routine for nested ternary operators, if it finds one you get fired.
  • 2
    Am I the only one that has to look up how the ternary operator works every. single. time? It just won't stick..
  • 1
    I used to feel like this, could not remeber if the ? or : came first. I am not sure how I learned to remember, maybe have just been repetition. @iguana
  • 2
    @juniordevjakub @iguana hehe, same here until I realized that the first statement is really a question, so I need to put a question mark right after.
    is_this_true?yes:no
  • 1
    @nblackburn I see your concern now :) Maybe because I mostly code in Python indentation looks natural and important to me. The reality it all of the white space in JS is for readability's sake, can only imagine reading that statement as one-liner.
  • 2
    I have nested ternary operator a few times myself....there I said it!
  • 0
    $hit happens just hope you get to be the first to realise u did some wrong &fix it before it get to @devrant or worse reddit so humiliating
  • 0
  • 0
    Then one day someone used a list as an index and got an exception
Add Comment