Necesito ayuda con mi JavaScript, cuando el usuario hace clic en el botón, quiero pedirle al usuario que ingrese un puntaje (0-100) y luego devolver una calificación basada en ese puntaje (por ejemplo, 100-80 = A, 79-60 = B) ... <30=F) Por cierto, explique cómo y por qué se hace cada paso porque soy bastante tonto, gracias.
<!DOCTYPE html> <html> <head> <title>Marks to Grade Conversion</title> <style> h1 {font-family:serif; font-size:36px; color:#ff0000; text-align:center} h2 {font-family:sans-serif; font-size:24px; color:#000000; text-align:center} body {background-color:#FFCC00} </style> </head> <body> <h2>Faculty of Computer science</h2><br> <h1>End of year module test results Mark to Grade utility</h1><br><br> <h2>Click the button to enter the Mark and display the Grade</h2><br> <h2><button style="font-size:24px; height:50px; width:300px"; onClick="ConvertMark()"> Click to enter the mark </button></h2><br> <h1 id="display grade here"></h1></b></td>bastante básico escriba su función, obtenga entrada, convierta, muestre el resultado
function ConvertMark(){ let display = document.getElementById('display') let grade = prompt("Enter grade: ") let alpha = ""; if (grade >= 90)alpha = 'A' else if(grade >= 80)alpha = 'B' else if(grade >= 70)alpha = 'C' else if(grade >=60)alpha = 'D' else alpha = 'F' display.innerHTML = alpha } h1 {font-family:serif; font-size:36px; color:#ff0000; text-align:center} h2 {font-family:sans-serif; font-size:24px; color:#000000; text-align:center} body {background-color:#FFCC00} <h2>Faculty of Computer science</h2><br> <h1>End of year module test results Mark to Grade utility</h1><br><br> <h2>Click the button to enter the Mark and display the Grade</h2><br> <h2><button style="font-size:24px; height:50px; width:300px"; onClick="ConvertMark()"> Click to enter the mark </button></h2><br> <h1 id="display"></h1>