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 Exploring JavaScript Conditionals!
You have completed Exploring JavaScript Conditionals!
Preview
Introduction to the ternary operator
Resources
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
The only problem is, is that it's so
compact it can be hard to read.
0:00
It's called ternary because it
involves three expressions.
0:04
The first is a boolean that determines
which of the next two expressions run.
0:08
The ternary operator uses two characters,
a question mark and a colon.
0:14
These two characters are markers for
our condition and our two branches.
0:20
Let's see how this works in
our two.js file from earlier.
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