First steps, Decisions
Scores into grades
The task
Turn a score from 0 to 100 into a grade:
| Score | Grade |
|---|---|
| 70 and above | A |
| 60 to 69 | B |
| 50 to 59 | C |
| 45 to 49 | D |
| 40 to 44 | E |
| below 40 | F |
Test the boundaries: 70, 69, 45, 44, 40, 39.
Write a function called grade.
Tests
| Call | Expected | Yours |
|---|---|---|
grade(85) |
"A" |
not run |
grade(70) |
"A" |
not run |
grade(69) |
"B" |
not run |
grade(60) |
"B" |
not run |
grade(55) |
"C" |
not run |
grade(50) |
"C" |
not run |
grade(47) |
"D" |
not run |
grade(45) |
"D" |
not run |
grade(44) |
"E" |
not run |
grade(40) |
"E" |
not run |
grade(39) |
"F" |
not run |
grade(0) |
"F" |
not run |
solution.js
Tab indents. To leave the editor, press Escape, then Tab.
Output
Run prints what your code prints. Run the tests to check your function.