switch

🌈 注意点

function test(c) {
  switch(c) {
    case c > 90: // 会这样比较 100 === (100 > 90) 也就是 100 === true 比较,结果是 false
      console.log(1);
      break;
    case c > 60:
      console.log(2);
      break;
    default:
      console.log(3);
      break;
  }
}
test(100); // 3
console.log(100 === (100 > 90)); // false

三目运算符(条件运算符)

var str = 89 > 9 ? 
    				'89' > '9' ?
    				'通过了' :
						'内层未通过'
					: '外层未通过'; // '内层未通过'

console.log(str);