curriculum/challenges/english/blocks/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md
The teacher is really happy with the program you have created so far. But now they want to have an easy way to check if a student has a passing grade. A passing grade is anything that is not an "F".
Complete the function hasPassingGrade that takes a student score as a parameter. Your function should return true if the student has a passing grade and false if they do not.
Tips
getGrade function to get the student's grade. Then check if the grade is passing or not.Your hasPassingGrade function should return a boolean value.
assert.strictEqual(typeof hasPassingGrade(100), "boolean");
Your hasPassingGrade function should return true if the grade is an "A".
assert.isTrue(hasPassingGrade(100));
Your hasPassingGrade function should return false if the grade is an "F".
assert.isFalse(hasPassingGrade(53));
Your hasPassingGrade function should return true for all passing grades.
assert.isTrue(hasPassingGrade(87));
assert.isTrue(hasPassingGrade(60));
assert.isTrue(hasPassingGrade(73));
assert.isTrue(hasPassingGrade(96));
function getAverage(scores) {
let sum = 0;
for (const score of scores) {
sum += score;
}
return sum / scores.length;
}
function getGrade(score) {
if (score === 100) {
return "A++";
} else if (score >= 90) {
return "A";
} else if (score >= 80) {
return "B";
} else if (score >= 70) {
return "C";
} else if (score >= 60) {
return "D";
} else {
return "F";
}
}
--fcc-editable-region--
function hasPassingGrade(score) {
}
console.log(hasPassingGrade(100));
console.log(hasPassingGrade(53));
console.log(hasPassingGrade(87));
--fcc-editable-region--