Grading Students

  • + 0 comments

    Javascript solution

    function gradingStudents(grades) {
        // Write your code here
        return grades.map((grade) => {
            if (grade < 38) return grade;
            const remainder = grade % 5;
            if (remainder >= 3) return grade + (5 - remainder);
            else return grade
        })
    }