Skip to content
Exercise · Conditions and loops · lesson 10 of 13

Exercise: letter grade

Write a function function grade(score) that turns points into a letter grade:

  • 90 points or more: "A";
  • 75–89: "B";
  • 60–74: "C";
  • below 60: "F".

Examples:

  • grade(90) → "A"
  • grade(74) → "C"
  • grade(59) → "F"

Constraints: score is an integer from 0 to 100 inclusive.

Do not add extra imports unless the task says so explicitly.

grade.js — javascript
javascript · 4 lines
Ctrl+Enter run · Esc leave editor

Subscribe to take the course

The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.

Sign in another way