DEV Community

Cover image for If Statements: The Quick Guide For Beginners
Deborah Kurz
Deborah Kurz

Posted on

If Statements: The Quick Guide For Beginners

(See The Header Image For How An If Statement Is Basically Written In A Function)

JavaScript likes to "solve" If Statements like a simple true or false scenario:

If the condition we give to a function is true (it matches exactly with the thing we've defined to the right of the ===), the function will return something.

If the condition we give to a function is false (it DOESN'T match exactly with the thing we've defined to the right of the ===), the function does NOT return anything.

You can remember when to use If Statements like this:

If TRUE, do something. If FALSE, do nothing. That's it.

Top comments (0)