0

Don't understand. ternary operator

Please give me some example

6th Sep 2017, 6:52 PM
Dang Ratchaburi
Dang Ratchaburi - avatar
2 Answers
+ 3
conditional (ternary) operator is the only JavaScript operator that takes three operands. This operator is frequently used as a shortcut for the if statement. Syntax condition ? expr1 : expr2 Parameters condition (or conditions)An expression that evaluates to true or false. expr1, expr2 Expressions with values of any type. Description If condition is true, the operator returns the value of expr1; otherwise, it returns the value of expr2
6th Sep 2017, 9:53 PM
Elvis Ngboki
Elvis Ngboki - avatar
+ 2
what language ?
6th Sep 2017, 9:50 PM
Elvis Ngboki
Elvis Ngboki - avatar