Reduza JavaScript médio
function average(nums) {
// nums.length is the important part
return nums.reduce((a, b) => (a + b)) / nums.length;
}
fast_and_the_curious
function average(nums) {
// nums.length is the important part
return nums.reduce((a, b) => (a + b)) / nums.length;
}
function average(nums){
return nums.reduce((a,b)=>(a+b)/ nums.length;
average([[1], [2], [3]]);