There is a conditional else if
Code works
let a = 2; if (a == 0) a = 1; else if (a < 0) a = 'less then zero'; else if (a > 0) a *= 10; console.log(a); The code does not work
How to write the same code using ternary operators?
let a = 2; a = a == 0 ? 1 : a < 0 ? 'less then zero' : a > 0 ? `${(a *= 10)}`; console.log(a); and I do not understand why it gives an error.
${(a *= 10)}: ''; Thanks for the suggestive question)) added: '' and it all worked!) - SomeUser