How to concatenate/link two ternary operators

// A ternary operator works like such

condition ? returnIfConditionIsTrue : returnIfConditionIsFalse

When you link two ternary operators together, the second return can be another condition that introduces another ternary operator. Like this.

condition1 ? returnIfConditionIsTrue : checkCondition2IfCondition1IsFalse ? returnIfCondition2IsTrue : returnIfCondition2IsFalse

Leave a comment

Design a site like this with WordPress.com
Get started