fork(1) download
  1. let num=[1,2,3,4,5,];
  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 16964KB
stdin
Standard input is empty
stdout
Total:15
Mean:3