Lemmy.one
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
philnash@programming.dev to JavaScript@programming.devEnglish · 2 years ago

Stop nesting ternaries in JavaScript

www.sonarsource.com

external-link
message-square
34
fedilink
43
external-link

Stop nesting ternaries in JavaScript

www.sonarsource.com

philnash@programming.dev to JavaScript@programming.devEnglish · 2 years ago
message-square
34
fedilink
Nesting ternary operators makes code more complex and less clear. Let's investigate other ways to write conditional expressions.
  • CameronDev@programming.dev
    link
    fedilink
    arrow-up
    7
    ·
    2 years ago

    Does this article need to exist? I assumed anyone writing a nested ternary was intentionally writing shit code

    • T (they/she)@beehaw.org
      link
      fedilink
      arrow-up
      6
      ·
      2 years ago

      Some people think they are being “cleaver” writing a lot of stuff in one line. So yes, it does.

JavaScript@programming.dev

javascript@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !javascript@programming.dev
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 1 user / day
  • 4 users / week
  • 18 users / month
  • 153 users / 6 months
  • 17 local subscribers
  • 2.47K subscribers
  • 188 Posts
  • 383 Comments
  • Modlog
  • mods:
  • Erlingur@programming.dev
  • Ategon@programming.dev
  • nick@programming.dev
  • BE: 0.19.7
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org