<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> <script type="text/javascript"> function sumGuo() { var result = 0; for(var i in arguments) { result += i; } return result; /*for(var i=0;i<arguments.length;i++) { result += arguments[i]; }*/ } alert(sumGuo(1,2,3,4,5)); //输出结果12345 alert(sumGuo(1,2,3,4,5,6,7,8,9)); //输出结果123456789 </script> </head> <body> </body> </html>