DEV Community

Discussion on: JavaScript Ternary Operator

Collapse
 
l2aelba profile image
l2aelba • Edited

I would do something like this…

let message = condition ? 'result' : 'default'
console.log(message)

Why? : Think about if you not just console.log or do async functions

Collapse
 
heytimapple profile image
Tim Apple

That's very cool, I'm still learning my way around myself so i'm pretty positive I haven't come close to wrapping my mind around all the possibilities.