Not many people know this, but for simple JavaScript “If” Statements, there’s a Syntax that allows you to write out the entire condition on one line.

Let’s take a quick If Statement and type it out the most common way:

Behold…the 1 liner Syntax:

By using a question mark and a colon, we can convert the above If Statement to the following:

Simple, but effective 🙂