let score = prompt("请输入成绩:");//输入成绩 let a = parseInt(score / 10);//将字符串转换为数字 switch (a) { case 6: console.log(`成绩为${score},成绩等级为D`); break; case 7: console.log(`成绩为${score},成绩等级为C`); break; case 8: console.log(`成绩为${score},成绩等级为B`); break; case 9: console.log(`成绩为${score},成绩等级为A`); break; default: console.log(`成绩为${score},成绩等级为E`); break; }