let ary=[1,9,2,8,3,7,4,6,5,5,6,4,7,3,8,2,9,1,0,10]; //av5
let av=ary.reduce((a,b,i,me)=>{return (i===me.length-1)?(a+b)/me.length:a+b})
console.log(av)
console.log(ary.reduce((a,b)=>a+b),ary.length)//check
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account log in.