Log in from a computer to take this course

You'll need to log in from a computer to start Create a Professional Website with Velo by Wix. But you can practice or keep up your coding streak with the Codecademy Go app. Download the app to get started.

apple storegoogle store
Learn

Way to go! Here are some of the major concepts for conditionals:

  • An if statement checks a condition and will execute a task if that condition evaluates to true.
  • if...else statements make binary decisions and execute different code blocks based on a provided condition.
  • We can add more conditions using else if statements.
  • Comparison operators, including <, >, <=, >=, ===, and !== can compare two values.
  • The logical and operator, &&, or “and”, checks if both provided expressions are truthy.
  • The logical operator ||, or “or”, checks if either provided expression is truthy.
  • The bang operator, !, switches the truthiness and falsiness of a value.
  • The ternary operator is shorthand to simplify concise if...else statements.
  • A switch statement can be used to simplify the process of writing multiple else if statements. The break keyword stops the remaining cases from being checked and executed in a switch statement.

Instructions

In main.js, practice the skills you learned in this lesson.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?