Given an array of numbers, such as [10, 20, 30, 40, 50] , write a function to calculate the average of this array.
[10, 20, 30, 40, 50]
function getAverage(arr){ return array.reduce((sum, currentValue) => sum + currentValue, 0) / arr.length }