Javascript Ternary Operator With Two Conditions That Impair