this post was submitted on 19 Jun 2025
6 points (100.0% liked)

JavaScript

2608 readers
8 users here now

founded 2 years ago
MODERATORS
top 4 comments
sorted by: hot top controversial new old
[–] chickenf622@sh.itjust.works 5 points 6 months ago (2 children)

This is probably just my general dislike of chained ternary operators, but why not just write this out the "long" way to make intention clearer?

[–] towerful@programming.dev 1 points 6 months ago

Yeh, I'd just do early return.
It's not much more typing, and I find it easier to read and navigate specific conditional paths.

Some built in pattern matching would be cool (like the when keyword), but I'm not going to force it into my code

[–] KaKi87@jlai.lu 1 points 6 months ago

Probably just my general dislike of verbosity 😅

[–] not_woody_shaw@lemmy.world 1 points 6 months ago