0

Can someone please explain how the question mark with the colon works in javascript. I have sees this:

var has_cheese = false;
var happy = has_cheese ? 'yes' : 'no'

I don't know why or what it is. I would really appreciate if someone could explain it to me.

  • 2
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator – Teemu Nov 15 '20 at 23:44

0 Answers0