Menu
Coddy logo textTech

Grading System

Lesson 14 of 14 in Coddy's Function Declarations in JavaScript course.

challenge icon

Challenge

Easy

Write a program that converts a numerical exam score (0-100) to a letter grade using a function expression.

Create a function expression named getLetterGrade that take one argument, userScore.

Inside the getLetterGrade function expression:

Use an if...else if...else statement to check the score range:

  • If the score is between 90 and 100 (inclusive), return "A Grade".
  • If the score is between 80 and 89 (inclusive), return "B Grade".
  • If the score is between 70 and 79 (inclusive), return "C Grade".
  • If the score is between 60 and 69 (inclusive), return "D Grade".
  • Otherwise (below 60), return "F Grade".

Try it yourself

// Write code here

All lessons in Function Declarations in JavaScript