I'm a software developer based in Newcastle Upon Tyne, England. I've got a wide range of experience in companies of varying sizes and cultures, and in roles of varying degrees of responsibility.
I'm a big fan of ternaries in JS, because IMO expressions are better than statements for reducing cognitive load, which is generally my primary goal when coding.
However, I find that my personal favourite formatting for ternaries is:
condition?valueIfTrue:valueIfFalse;
To be clear though, I do believe that if/else is better for readability (especially for less experienced developers), and I prefer languages which only have expressions (and consequently their if/elses are expressions too). But for languages that aren't as nice as that, I always prefer ternaries for assignments.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I'm a big fan of ternaries in JS, because IMO expressions are better than statements for reducing cognitive load, which is generally my primary goal when coding.
However, I find that my personal favourite formatting for ternaries is:
To be clear though, I do believe that
if/else
is better for readability (especially for less experienced developers), and I prefer languages which only have expressions (and consequently their if/elses are expressions too). But for languages that aren't as nice as that, I always prefer ternaries for assignments.