...

/

if-statements, continued

if-statements, continued

Learn what truthy and falsey mean in JavaScript. Learn how to make if-statements more powerful.

We'll cover the following...

“Truthy” and “Falsey”

If-statements don’t work only with booleans. We can use any variable type inside the if-statement parentheses.

If we don’t use true or false variables, JavaScript will forcibly coerce whatever we put inside the parentheses to true or false. It’ll then decide whether to run the code or not.

A value that coerces to true is referred to as “truthy”. One that coerces to false is “falsey”.

So how ...