Last active
March 9, 2020 14:22
-
-
Save s0kil/6cdbb6db16720af78c8df381a59ab9ed to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| function gradingStudents(grades) { | |
| function checkRoundedGrade(grade) { | |
| if (grade < 38) return grade; | |
| let gradeRounded = Math.ceil(grade / 5) * 5; | |
| if ((gradeRounded - grade) < 3) return gradeRounded; | |
| else return grade; | |
| } | |
| return grades.map(grade => checkRoundedGrade(grade)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment