Javascript Ternary Operator With Two Conditions Necessary