We want to make this open-source project available for people all around the world.

Help to translate the content of this tutorial to your language!

back to the lesson

Rewrite 'if' into '?'

importance: 5

Rewrite this if using the conditional operator '?':

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