curriculum/challenges/english/blocks/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md
Now the teacher needs your help converting the student score to a letter grade.
Complete the getGrade function that takes a number score as a parameter. Your function should return a string representing a letter grade based on the score.
Here are the scores and their corresponding letter grades:
| Score Range | Grade |
|---|---|
100 | "A++" |
90 - 99 | "A" |
80 - 89 | "B" |
70 - 79 | "C" |
60 - 69 | "D" |
0 - 59 | "F" |
Tips
if, else if, and else).>, <, >=, <=, ===).&&).Your getGrade function should return "A++" if the score is 100.
assert.strictEqual(getGrade(100), "A++");
Your getGrade function should return "A" if the score is 94.
assert.strictEqual(getGrade(94), "A");
Your getGrade function should return "B" if the score is between 80 and 89.
assert.strictEqual(getGrade(80), "B");
assert.strictEqual(getGrade(83), "B");
assert.strictEqual(getGrade(88), "B");
Your getGrade function should return "C" if the score is 78.
assert.strictEqual(getGrade(75), "C");
Your getGrade function should return "D" if the score is between 60 and 69.
assert.strictEqual(getGrade(60), "D");
assert.strictEqual(getGrade(63), "D");
assert.strictEqual(getGrade(68), "D");
Your getGrade function should return "F" if the score is 57.
assert.strictEqual(getGrade(57), "F");
Your getGrade function should return "F" if the score is between 0 and 59.
assert.strictEqual(getGrade(0), "F");
assert.strictEqual(getGrade(30), "F");
assert.strictEqual(getGrade(43), "F");
function getAverage(scores) {
let sum = 0;
for (const score of scores) {
sum += score;
}
return sum / scores.length;
}
--fcc-editable-region--
function getGrade(score) {
}
console.log(getGrade(96));
console.log(getGrade(82));
console.log(getGrade(56));
--fcc-editable-region--