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
JavaScript has a particular operator to test more than one condition. It's called a logical "AND" operator, represented by two ampersands (&&).
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
In this case, you might ask,
if it's a hot day and I know how to swim,
0:00
then I'll go swimming.
0:04
There are two tests here.
0:05
Is it a hot day and do I know how to swim?
0:07
In order to move on to the action going
swimming, they both have to be true.
0:10
If the first condition is false,
for example, it's not a hot day,
0:15
then no action is taken.
0:19
If the second condition is false,
I don't know
0:21
how to swim It doesn't matter if it's
a hot day, I won't be going swimming.
0:24
JavaScript has a special operator
to test more than one condition.
0:28
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