Javascript Ternary Operator With Two Conditions Are Required