// 생략
/*
* Complete the 'gradingStudents' function below.
*
* The function is expected to return an INTEGER_ARRAY.
* The function accepts INTEGER_ARRAY grades as parameter.
*/
function gradingStudents(grades) {
// Write your code here
const final = grades.map(g => {
let grade = g;
if (grade >= 38) {
const multiple = Math.ceil(g/5)*5;
const diff = multiple - g;
if (diff < 3) {
grade = multiple;
}
}
return grade;
});
return final;
}
// ..후략