The ternary or conditional operator is the only Javascript operator that takes three operands. This operator is a shortcut for the if statement. It tests the condition and returns one value or expression if it is true and another if it is false.

The example below shows there is a…

--

--