Topic Description

Given an array of numbers, such as [10, 20, 30, 40, 50] , write a function to calculate the average of this array.

Answer

function getAverage(arr){
	return array.reduce((sum, currentValue) => sum + currentValue, 0) / arr.length
}