/*
Ternary operators are a way to quickly evaluate logic in JavaScript. It takes
three operands in the format
expression ? if true : if not true
However, these are simply, and as such, they cannot return values - they can
only assign value.
*/
/*
If the expression is evaluated as true, it will return the value in the first
expression block. Otherwise, it returns the value in the second expression block.
*/
var expression = false;
var value = expression ? true : false;
console.log(value);
/*
The evaluation can still run even if it is not assigned to a variable; it can
then assign value to free variables. However, if the same expression is assigned
to a variable, it will return the value assigned to the free variable.
*/
var b = 0;
expression ? b = 1 : b = 2;
var c = expression ? b = 1 : b = 2;
console.log(b);
console.log(c);