三元运算符

(条件) ? 表达式1 : 表达式2

var msg = '数字' + n + '是' + (n % 2 === 0 ? '偶数' : '奇数');
原文地址:https://www.cnblogs.com/lpp-11-15/p/11276640.html