<<<<<<< HEAD Code Wars - Brett Crafton

Get the mean of an array

Question

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.

No examples

Solution by -

My Solution


	function getAverage(marks){
		return Math.floor(marks.reduce((a,b) => a + b, 0) / marks.length)
		}
				

Try it yourself - CodeWars

======= Code Wars - Brett Crafton

Get the mean of an array

Question

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.

No examples

Solution by -

My Solution


	function getAverage(marks){
		return Math.floor(marks.reduce((a,b) => a + b, 0) / marks.length)
		}
				

Try it yourself - CodeWars

>>>>>>> 0e614172debaa009c8d31330edbeb3b765b59c39