Ternary Operator

The is a more advanced operator in computer programming that is an alternative to an if-else statement. The ternary operator is just a question mark (a ?) and the syntax is condition ? value1 : value2 where condition is one that you would normally put in an if statement. is useful in not only Khan Academy's Processing JavaScript environment, but in many programming languages such as JavaScript and C++. There can also be a ternary operator within a ternary operator.
Category:Computing
Category:JS Documentation