First one here is the ternary operator. It can be used to shorten the usual syntax of if ... else statement.
can be written with tenary operator as:
It can be chained to make longer statments
Awesome right? I know. Let’s look at ways to shorten other conditional statements.
Truthy & Falsy Assigment
If you didn’t already guess, this one targets truthy & falsy statements.
An example for this would be
Finally we’ll look at the switch keyword which matches values to a cases and can be used to write shortcut also for conditional statments.
and can write it as
At first glance, this may not look particularly short but imagine having to write lines and lines of else if statements, this definitely has better readablility and it easier to write.