C. Second ternary is missing the else part after colon.
D. No error; code is valid.
Solution
Step 1: Check each ternary usage
The first ternary is correct with both true and false parts. The second uses {isReady ? <p>Go!</p> : null} which is valid syntax.
Step 2: Understand ternary operator requirements
The ternary operator requires both true and false expressions separated by a colon. Here, the else part is null, which is valid JSX.
Final Answer:
No error; code is valid. -> Option D
Quick Check:
Ternary needs both ? and : parts, and else can be null [OK]
Hint: Ternary always needs ? and : parts [OK]
Common Mistakes:
Omitting the else expression
Confusing ternary with logical AND
Thinking JSX can't have ternary
5. You want to display a list of user names with a label showing if they are online or offline using ternary inside JSX. Which code correctly implements this?