I am trying to write a Javascript function rounding up to the nearest multiple of 5. But you only round up if the difference between the variable and the roundup to the multiple of 5 is less than 3. (so 53 would round up to 55, but 52 would stay 52.)
Also if the grade is < 38 its an F.
The code below is what I have but it is not running properly. How can I fix it?
Thanks!!
grade = 71
function roundGrade (grade) {
const remainder = grade % 5
if (grade < 38) {
return "fail"; }
else if (remainder >= 3) {
grade; }
else if (remainder < 3) {
grade-remainder+5
}
}