return the average
js challenge
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]))
function myFunction(arr) {
let total = arr.reduce((x, y) => x + y)
let avg = total/arr.length
return avg
}
console.log(myFunction([10,100,40]))