19
Nov
What is Ternary? Ternary Operator is a javascript operator which is available across browsers since July 2015. It is a shorthand alternative for if/else statements. This operator is widely-used in different programming languages like Java, C, Python but our focus in this article will be on javascript. Let's check out the general syntax of ternary operator. condition ? ifTrue : ifFalse Enter fullscreen mode Exit fullscreen mode As you can see from the example above, ternary operator replaces if and else statements, accordingly, with ? and : symbols. The condition which is on the left-hand side of the question mark…