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
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
List of users who liked
00