-
-
Save SRNT/58954661311c9baec71753496bcb8224 to your computer and use it in GitHub Desktop.
For checking a student grade with percentage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const gradScore = (sScore, totalScore = 100) => { | |
const score = Math.floor(sScore / 10); | |
var grade = { | |
10: 'A', | |
9: 'A', | |
8: 'B', | |
7: 'C', | |
6: 'D', | |
5: 'F', | |
4: 'F', | |
3: 'F', | |
2: 'F', | |
1: 'F', | |
0: 'F' | |
} [score]; | |
return `You got ${grade} (${sScore}%)`; | |
}; | |
let studantScore = gradScore(90); | |
console.log(studantScore); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment