当前位置:网站首页>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 (
边栏推荐
- Appearance of LabVIEW error dialog box
- 19.Frambuffer应用编程
- Introduction to AMBA
- Input displays the currently selected picture
- BUU-Crypto-[GUET-CTF2019]BabyRSA
- Character types of C language
- Remote desktop client RDP
- Excel comparator
- 2022 t elevator repair operation certificate examination question bank and simulation examination
- Canoe panel learning video
猜你喜欢
js如何将秒转换成时分秒显示
【QT】制作MyComboBox点击事件
Just do it with your hands 7 - * project construction details 2 - hook configuration
BUU-Crypto-Cipher
[paper summary] zero shot semantic segmentation
企业级日志分析系统ELK(如果事与愿违那一定另有安排)
transformer坑了多少算力
拓扑排序和关键路径的图形化显示
BUU-Pwn-test_ your_ nc
Upper computer software development - log information is stored in the database based on log4net
随机推荐
Actual cases and optimization solutions of cloud native architecture
[technology development -25]: integration technology of radio and television network, Internet, telecommunication network and power grid
BUU-Crypto-[GXYCTF2019]CheckIn
LC周赛300
Basic concept of bus
2022年R2移动式压力容器充装复训题库及答案
Easy change
2022g2 power station boiler stoker special operation certificate examination question bank and answers
Use of hutool Pinyin tool
力扣(LeetCode)184. 部门工资最高的员工(2022.07.03)
Enterprise level log analysis system elk (if things backfire, there must be other arrangements)
Yyds dry goods inventory TCP & UDP
Letter meaning and parameter abbreviation of optical module Daquan
Notepad++--显示相关的配置
C语言简易学生管理系统(含源码)
Thread pool: use thread pool to optimize query speed
【QT】制作MyComboBox点击事件
How to use postman to realize simple interface Association [add, delete, modify and query]
How much computing power does transformer have
Signification des lettres du module optique et abréviation des paramètres Daquan