js之argument小解
参考https://www.cnblogs.com/gongyijie/p/9425549.html
1 var i = 0; 2 var result = 0; 3 function sum(){ 4 for(i = 0; i < arguments.length; i++){ 5 result += arguments[i]; 6 } 7 return result; 8 } 9 alert(sum(1,2,3,4,5,6));
参考https://www.cnblogs.com/gongyijie/p/9425549.html
1 var i = 0; 2 var result = 0; 3 function sum(){ 4 for(i = 0; i < arguments.length; i++){ 5 result += arguments[i]; 6 } 7 return result; 8 } 9 alert(sum(1,2,3,4,5,6));