当前位置:网站首页>js arguments参数使用和详解
js arguments参数使用和详解
2022-07-04 05:29:00 【天马3798】
一、arguments 参数介绍
arguments,它是js中函数内置的一个对象,而执行函数方法的实参中值都存储在arguments中;
要想获取到这些实参,就需要像数组一样,用下标/索引来定位到每个值上面,但是又不能说它是一个数组,因为它里面还有其他的属性,如callee;
并且不能对它使用shift、push、join等方法。
而没有传递值的命名参数将会被自动赋予undefined;
arguments.length----参数个数
arguments.callee()---调佣自身
二、使用案例
案例1:
function show() {
console.info(arguments);
//arguments.callee()
}
show();
show(1, 2);
show(window, 1)
案例2:
function sum() {
var result = 0;
for (
边栏推荐
- Electronic components mall and data manual download website summary
- Trie number dictionary tree
- How much computing power does transformer have
- 2022g2 power station boiler stoker special operation certificate examination question bank and answers
- What is MQ?
- Principle and practice of common defects in RSA encryption application
- VB.net GIF(制作、拆解——优化代码,类库——5)
- Introduction to AMBA
- C # character similarity comparison general class
- Arc135 C (the proof is not very clear)
猜你喜欢
光模塊字母含義及參數簡稱大全
C语言简易学生管理系统(含源码)
Etcd database source code analysis - initialization overview
一键过滤选择百度网盘文件
js如何将秒转换成时分秒显示
Halcon image calibration enables subsequent image processing to become the same as the template image
Google Chrome browser will support the function of selecting text translation
2022年A特种设备相关管理(电梯)考试题模拟考试平台操作
Evolution of system architecture: differences and connections between SOA and microservice architecture
Canoe panel learning video
随机推荐
left_ and_ right_ Net normal version
TCP state transition diagram
BUU-Real-[PHP]XXE
Upper computer software development - log information is stored in the database based on log4net
Introduction To AMBA 简单理解
Introduction to AMBA
fastjson
[paper summary] zero shot semantic segmentation
拓扑排序和关键路径的图形化显示
SQL injection - injection based on MSSQL (SQL Server)
Integer type of C language
Excel 比较日器
光模块字母含义及参数简称大全
With the advent of the IP era, how can E-sports hotels take advantage of the "east wind" of games?
Unity2d -- character moves and turns
What are the reasons for the frequent high CPU of ECS?
left_and_right_net可解释性设计
FreeRTOS 中 RISC-V-Qemu-virt_GCC 的 锁机制 分析
光模塊字母含義及參數簡稱大全
transformer坑了多少算力