Ternary Operator
Ternary Operator
A ternary expression chooses between two values. It is best for short decisions where both branches produce a value.
Your task: Create publishLabel from the provided boolean. Published content should be labeled "Live"; unpublished content should be labeled "Draft". Log the label.
Free with a JS Exercises account
Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.
By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.
Ternary Operator
A ternary expression chooses between two values. It is best for short decisions where both branches produce a value.
Your task: Create publishLabel from the provided boolean. Published content should be labeled "Live"; unpublished content should be labeled "Draft". Log the label.