js中arguments的用法(实例讲解)
时间:2024-06-15 08:20:08
如下所示:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>arguments的使用</title>
</head>
<body>
<script type="text/javascript">
function display() {
document.writeln('该公司共有' + arguments.length + '人');
var sum = 0;
for (var i = 0; i < arguments.length; i++) {
sum += arguments[i];
}
return sum;
}
sum = display(1000, 2000, 3000, 4000, 5000);
document.writeln('sum1:' + sum + '<br/>');
sum = display(100, 200, 300);
document.writeln('sum2:' + sum);
</script>
</body>
</html>
标签:js,arguments
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
浅析Mysql和Oracle分页的区别
2024-01-23 16:38:49
![](https://img.aspxhome.com/file/2023/6/67026_0s.png)
RSA加密解密算法 asp源码
2009-08-28 13:10:00
python并发场景锁的使用方法
2022-12-30 17:25:20
django中的ajax组件教程详解
2023-11-19 00:59:32
![](https://img.aspxhome.com/file/2023/6/99026_0s.jpg)
django模型中的字段和model名显示为中文小技巧分享
2021-04-01 15:03:54
查询mysql中执行效率低的sql语句的方法
2024-01-24 09:58:36
java使用dbcp2数据库连接池
2024-01-29 05:33:42
![](https://img.aspxhome.com/file/2023/8/97798_0s.jpg)
符合w3c标准flash插入代码,常用flash参数设置
2009-01-20 18:47:00
设计师的底线
2009-05-06 12:51:00
编写PHP脚本使WordPress的主题支持Widget侧边栏
2023-11-23 20:27:13
![](https://img.aspxhome.com/file/2023/3/55613_0s.png)
Go语言基于HTTP的内存缓存服务的实现
2024-05-21 10:25:12
如何在PyCharm中配置使用Anaconda环境
2021-01-28 14:16:53
![](https://img.aspxhome.com/file/2023/6/112596_0s.jpg)
Python中文件遍历的两种方法
2022-01-28 20:34:03
详解Python import方法引入模块的实例
2021-01-10 04:21:08
根据表中数据生成insert语句的存储过程
2008-11-10 12:13:00
python如何实现API的调用详解
2023-12-26 18:24:07
![](https://img.aspxhome.com/file/2023/6/133416_0s.png)
请问能否在ASP中调用DLL
2009-06-07 18:24:00
搞定web设计中网页路径问题
2007-09-22 08:52:00
Mysql事物锁等待超时Lock wait timeout exceeded;的解决
2024-01-22 03:51:08
pycharm 激活码及使用方式的详细教程
2023-05-16 15:11:15
![](https://img.aspxhome.com/file/2023/1/120911_0s.png)