Back to the lesson

Rewrite 'if' into '?'

importance: 5

Rewrite this if using the ternary operator '?':

if (a + b < 4) {
  result = 'Below';
} else {
  result = 'Over';
}
result = (a + b < 4) ? 'Below' : 'Over';