return the average

js challenge

by oktaviardi pratama

JavaScript

function myFunction(arr) {
   let total = arr.reduce((x, y) => x + y)
   let avg = total/arr.length
   
   return avg
}

console.log(myFunction([10,100,40]))