Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed JavaScript Basics!
You have completed JavaScript Basics!
Preview
The most important part of a conditional statement is the condition itself. It's a test that checks to see if something is either true or false. JavaScript provides "comparison operators" to help with conditional statements.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
It made decisions and carried out actions
accordingly depending on different inputs.
0:00
The most important part of the conditional
statement is the condition itself.
0:05
It's a test that checks to see if
something is either true or false.
0:09
For example, in this code, the condition
is spaceShips === 0, which breaks down
0:13
to a simple question, is the value stored
in the variable spaceShips equal to zero?
0:18
The answer is either yes or no.
0:23
If the answer is yes, the game is over and
an alert dialog appears.
0:26
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up