condition ? statement-if-true : statement-if-false;

三元操作符

conditional US: [kən'dɪʃ(ə)nəl] 条件句 附带条件的

ternary 三元的 三个的 三重的 三元运算符

嵌套三元操作符

function findGreaterOrEqual(a, b) {
  return (a === b) ? "a and b are equal" 
    : (a > b) ? "a is greater" 
    : "b is greater";
}

function findGreaterOrEqual(a, b) {
  return (a === b) ? "a and b are equal" : (a > b) ? "a is greater" : "b is greater";
}