fork download
  1. let num=[5,6];
  2. let sum=num.reduce(myfun);
  3. function myfun(total,value)
  4. {return total+value};
  5. console.log("Total="+sum);
  6. console.log("Mean="+sum/num.length)
Success #stdin #stdout 0.03s 18820KB
stdin
Standard input is empty
stdout
Total=11
Mean=5.5