Ternary Operator

A shorter way to write if else statement.

HTML

<span>{{result}}</span>

JavaScript

var x = 10
var y = 20

if (x > y) {
  result = "good job";
}
else {
  result = 20;
}

//Below is the above code written using the ternary operator
result = x > y ? "good job" : 20;