求任意一组数的平均值
js
<script type="text/javascript"> function getAvg() { var sum = 0, len = arguments.length, i; for(i = 0; i<len; i++) { sum += arguments[i]; } return sum/len; } var avg = getAvg(11,22,33,44,88) console.log(avg) </script>
略懂,略懂....