Currently writing a function that converts a numerical grade into American system. Basically the result should be like this:
You got a D (60%)!
But I get this :
You got a 60 60%!
Apart from the brackets what should I do to make it look like as much as possible?
the code is below:
function gradeConverting(grade) {
let gradePercent = grade + "%";
switch (grade) {
case (90 < grade && grade <= 100):
grade = "A";
break;
case (80 < grade && grade <= 89):
grade = "B";
break;
case (70 < grade && grade <= 79):
grade = "C";
break;
case (60 <= grade && grade <= 69):
grade = "D";
break;
case (50 <= grade && grade <= 59):
grade = "E";
break;
case (grade <= 49):
grade = "F";
break;
}
return console.log("You got a " + grade + " " + gradePercent + "!");
}
gradeConverting(55);