📜  评分计算器公式 javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:12.156000             🧑  作者: Mango

代码示例1
var stars = [0, 0, 2, 3, 5],
    count = 0,
    sum = 0;

stars.forEach(function(value, index){
  count += value;
  sum += value * (index + 1);
});

console.log(sum / count);