re: Rethinking JavaScript: The if statement VIEW POST

re: Agreed. In most cases, ternaries are not improvements but an obscure alternative to standard if else clauses. Better ways to tackle if else clause...

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.

code of conduct - report abuse