当前位置:网站首页>js的arguments
js的arguments
2022-06-25 04:00:00 【刘家奕_】
目录
(2)arguments.length可以用来获取实参的长度
(1)在调用函数时,浏览器每次都会传递进两个隐含的参数;
1.函数的上下文对象this
2.封装实参的对象arguments
(1)验证是否存在arguments
<script>
function fun() {
console.log(arguments);
}
fun();
</script>
所以存在;
- arguments是一个类数组对象,它也可以通过索引来操作数据,也可以获取长度
-在调用函数时,我们所传递的实参都会在arguments中保存
类数组对象:我们来验证它不是数组(两种方法)
<script>
function fun() {
console.log(arguments instanceof Array);
console.log(Array.isArray(arguments));
// console.log(arguments.length);
}
fun();
</script>
明显不是数组--------而是类数组
(2)arguments.length可以用来获取实参的长度
<script>
function fun() {
console.log(arguments.length);
}
fun("刘", "家", "奕");
</script>
-我们即使不定义形参,也可以通过arguments来使用实参,
只不过比较麻烦
arguments[0]表示第一个实参
arguments[1]表示第二个实参........
(3)它里边有一个属性叫做callee
这个属性对应一个函数对象,就是当前正在指向的函数的对象
<script>
function fun() {
console.log(arguments.callee == fun);
}
fun();
</script>
边栏推荐
- Gbase 8s parallel operation problem scenario description
- kenlm
- Anaconda安装+TensorFlow安装+Keras安装+numpy安装(包含镜像和版本信息兼容问题)
- Office macro virus bounce shell experiment
- @Requestbody solution get parameter is null
- GBASE 8s的数据视图
- Comparison of towe/ JIRA / tapd / Zen collaboration platforms
- A detailed summary of four handshakes (or four waves) over TCP connections
- The yii2 debug toolbar is missing
- js中的concat()
猜你喜欢
OBS Browser+浏览器的基本使用
Lecture record: data processing methods and applications of various spatial geodetic techniques
冰冰学习笔记:循环队列的实现
CTF_ Web:8-bit controllable character getshell
Anaconda安装+TensorFlow安装+Keras安装+numpy安装(包含镜像和版本信息兼容问题)
无法安装redis接口
CTF_ Web: Learn flask template injection (SSTI) from 0
navicat可不可以直接操作安卓数据库SQLite
Read lsd-slam: large scale direct monolithic slam
CTF_ Web: basic 12 questions WP of attack and defense world novice zone
随机推荐
GBASE 8s活锁、死锁问题的解决
Lecture record: data processing methods and applications of various spatial geodetic techniques
SQL injection details
GBASE 8s的数据视图
2021.6.14 notes
2021.8.29 notes: register, bit operation, pointer, structure
Unit test coverage
GBASE 8s 索引B+树
Laravel document sorting 7. View
CTF_ Web: deserialization of learning notes (II) CTF classic test questions from shallow to deep
简单的恶意样本行文分析-入门篇
GBASE 8s中DELIMIDENT环境变量的使用
CTF_ Web: how to recognize and evaluate a regular expression
GBASE 8s的多线程结构
Musk released humanoid robot. Why is AI significant to musk?
Communication problems in parent and child components of uniapp
LabVIEW开发气体调节器
Introduction to intstream API
Can Navicat directly operate the Android database SQLite
Comparison of towe/ JIRA / tapd / Zen collaboration platforms