{"id":9345,"date":"2021-01-05T14:34:40","date_gmt":"2021-01-05T19:34:40","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=9345"},"modified":"2021-12-04T06:42:47","modified_gmt":"2021-12-04T06:42:47","slug":"javascript-ternary-operator-examples","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/javascript-ternary-operator-examples\/","title":{"rendered":"How to Use The JavaScript Ternary Operator With Examples"},"content":{"rendered":"\n
The JavaScript ternary operator also called the conditional operator or Question mark operator is an operator that takes three operands. It is the only JavaScript operator that takes three operands.<\/p>\n\n\n\n
It consists of a condition followed by a question mark (?), then an expression to execute if the condition is true followed by a colon (:). Finally, the expression to execute if the condition is false comes thereafter. This operator is frequently used as a shortcut for the if statement.<\/p>\n\n\n\n