let num=[1,2,3,4,5,6];let sum=num.reduce(myfun);function myfun(a,b){return a+b};console.log("Total="+sum);console.log("Mean="+sum/num.length)
Standard input is empty
Total=21 Mean=3.5
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!