Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
You'll often hear conditionals referred to as if/else statements. In this video, we'll provide code that runs only if a condition is false, using an else
clause. It's optional, but is often used as a "fall back" for when a condition isn't true.
Next Steps
Resources
Template Literals
- Expression interpolation
- if...else
- Making decisions in your code — conditionals
- JavaScript reference – MDN
What is the ${}
syntax?
The expression inside ${…}
is evaluated and the result becomes a part of the string. We can put any valid expression inside ${…}
: a variable like playerName
or an arithmetical expression like 1 + 2
or something more complex.
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
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