标签:AC fun for red UNC IV div TE func
function sum(arr) { var result = 0; arr.forEach(function(item,index) { result += item; }); return result; };
function sum(arr) { return arr.reduce(function(pre,cur){ return pre+cur; }) }
function sum(arr) { return eval(arr.join("+")); }
[1,2,3,4].join(‘+‘) //"1+2+3+4" eval("1+2+3+4"); //10
function sum(arr) { var result= 0; var len=arr.length; for (var i=0;i<len;i++) { result += arr[i]; } return result; }
标签:AC fun for red UNC IV div TE func
原文地址:https://www.cnblogs.com/sunmarvell/p/9161619.html