标签:sum += func previous 个数 style div pre return
1
function foo (...args) { return args.reduce(function (previousValue, currentValue) { // console.log(previousValue, currentValue) return previousValue += currentValue; }) } console.log(foo(1, 32, 34, 5, 6))
2
function sum () { var result = 0; for(var i = 0, len = arguments.length; i < len; i++) { result += arguments[i] } return result; } console.log(sum(1, 2, 3 , 4, 5))
标签:sum += func previous 个数 style div pre return
原文地址:https://www.cnblogs.com/penggedeboke1999/p/12039093.html