[codewars] 배열의 평균값 구하기
2018-05-24 (한 달 전)algorithm
summary
It's the academic year's end, fateful moment of your school report. The averages must be calculated. All the students come to you and entreat you to calculate their average for them. Easy ! You just need to write a script.
Return the average of the given array rounded down to its nearest integer.
The array will never be empty.
function getAverage(marks){
return Math.floor(marks.reduce((prev, curr) => prev + curr) / marks.length);
}