当前位置: 代码迷 >> 综合 >> 【js】用三目运算符取代switch
  详细解决方案

【js】用三目运算符取代switch

热度:80   发布时间:2024-01-25 00:03:09.0

var gro = (student)=>{

    var score = student.score;

    return  score < 65 ? 'F':

            score < 70 ? 'E':

            score < 80 ? 'C':

            score < 90 ? 'B':'A';

};

  相关解决方案