let [userSelect,userWrongSelect] = [2,13] // 逢一点击打分逻辑 if (userSelect > 7) { // 50%以上扣0.5分 if (userSelect >= 12 && userWrongSelect <= 3) { // 对80%且错误不超过三次直接满分 console.log(10) } else { // 错1扣0.5 let score = (10 - userWrongSelect / 2) console.log(`score:${score > 0 ? score.toString() : '0'}`) } } else { // 50%以下错1扣1 if (!userWrongSelect && !userSelect) { console.log('0') } else { let score = (10 - userWrongSelect) console.log(`score:${score > 0 ? score.toString() : '0'}`) } }