【发布时间】:2013-12-18 09:58:44
【问题描述】:
当这个方法被调用时 knownScore = 70, 新分数 = 70, 深度 = 1, 它返回 3535 !!!!!! 这怎么可能?
this.weightedAvg = function(depth, knownScore, newScore) {
if ((knownScore > 100) || (knownScore < -100)) return newScore;
else return Math.round((depth*knownScore + newScore)/(depth + 1));
};
当使用值 35、70、2 调用时,它返回 2357! 有什么帮助吗?
【问题讨论】:
-
为我返回 70:jsfiddle.net/tjht7
标签: javascript methods return