Cofounded Host Collective (DiscountASP.net). Cofounded Player Axis (Social Gaming). Computer Scientist and Technology Evangelist with 20+ years of experience with JavaScript!
There is nothing obscure about a ternary statement. It is possible that you are less familiar with an ternary and more familiarity with an if statement (aka familiarity bias). This only has to do with what you have been more exposed to. But there is nothing about a ternary that makes it "obscure".
They key to this change (if -> ternary) is the elimination of statements and blocks and a shift to expressions.
The use of statements and blocks is an imperative style of programming and are unnecessary in functional programs.
When you eliminate statements and blocks, you will find that your code will naturally become more functional.
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.
Agreed. In most cases, ternaries are not improvements but an obscure alternative to standard if else clauses.
Better ways to tackle if else clauses would be early returns and functional practices.
There is nothing obscure about a ternary statement. It is possible that you are less familiar with an ternary and more familiarity with an if statement (aka familiarity bias). This only has to do with what you have been more exposed to. But there is nothing about a ternary that makes it "obscure".
They key to this change (if -> ternary) is the elimination of statements and blocks and a shift to expressions.
The use of statements and blocks is an imperative style of programming and are unnecessary in functional programs.
When you eliminate statements and blocks, you will find that your code will naturally become more functional.