• Loading . . .

WARNING

Are you sure you want to reset the challenge? You'll lose all changes you've made to the code.

Mini Project: Grade Calculator

Time to put what you've learned about conditionals to use.

The code in index.html renders a web page with an input box and a button. It also has a bit of JavaScript that manages the button click. You don't need to modify anything in the HTML file.

Your job is to write the logic for the calculateGrade function defined in script.js.

Use your expertise with conditionals -- if, else if, and else -- to calculate the letter grade based on the user's input:

  • 98-100: A+
  • 95-97: A
  • 93-94: A-
  • 90-92: B+
  • 87-89: B
  • 85-86: B-
  • 82-84: C+
  • 79-81: C
  • 77-78: C-
  • 74-76: D+
  • 70-73: D
  • below 70: F

Try your grade calculator after -- just be sure to press the play button to reload your code. There are tests, too. Click the check mark to run them. You'll have to toggle from the "Web Page" to the "Test Results" tab to see the results.