30 Days Of JavaScript

Day 7: Consolidation 1

Lesson 3: Logic

if

Logic, also known as conditionals, allows us to control which parts of our code get executed in which situations. The most basic form is the if statement.

We use boolean operators such as === or <= to determine if a condition is true or false and execute the relevant code.

AND

We can check multiple statements with the 'AND' operator &&

In an 'AND' check each condition being checked much be true for the overall condition to be considered true.

OR

If we want to execute code based on if one, or more, of any set of conditions are true, then we use the OR operator ||

If Else

To save us having to code for each version of a set of conditions, we can simply code an if and pair it with an else to catch the inverse of that check.

If, Else if, Else

If we do want to check some intermediate levels then we can use else if statements to catch those.

Outline

Go Pro?

Upgrade to Pro for quizzes, tracked progress and a completion certificate for just $25 🚀

Want more developer tips, tricks and tools?
Then follow me:
FREE Coding Career Quick Start Guide 🚀
Discover the best way to learn to code, how to land a job and valuable resources to help your journey in this free 15 page value packed guide.
Looking to email me? You can get me on my first name at allthecode.co