The ternary operator can be confusing, as it dehydrates the longer if/else code blocks into a single line of code. It eliminates the repeating pattern. But what about the ?:
syntax? How does that work? When should you use it?
Check out the other syntax here.
This tip is valid for JavaScript and PHP.
Did you learn something new? Share your thoughts.