Flash cards
Review the key moves
1/4
Core idea
What is the main idea behind React ES6 Ternary Operator?
Lesson checks
Practice each idea before moving on
Short Mimo-style checks built from this lesson's code, terms, and sequence.
1Quick choice
Which statement best captures the main point of this lesson?
2Fill blank
Complete the missing token from the example code.
___ (authenticated) {3Order
Put the learning moves in the order that makes the concept easiest to apply.
Here is the same example using a ternary operator:
Here is an example using if / else :
The ternary operator is a simplified conditional operator like if / else .
Ternary Operator
The ternary operator is a simplified conditional operator like if / else .
Syntax: condition ? <expression if true> : <expression if false>
Here is an example using if / else :
if (authenticated) {
renderApp();
} else {
renderLogin();
}Here is the same example using a ternary operator:
authenticated ? renderApp() : renderLogin();