js arguments和caller,callee
来源:互联网 发布:现货白银软件 编辑:程序博客网 时间:2024/05/16 19:02
javascript中函数的隐含参数:arguments
arguments是进行函数调用时,除了指定的参数外,还另外创建的一个隐藏对象。Arguments是一个类似数组但不是数组的对象,说它类似数组是因为其具有数组一样的访问性质及方式,可以由arguments[n]来访问对应的单个参数的值,并拥有数组长度属性length。还有就是arguments对象存储的是实际传递给函数的参数,而不局限于函数声明所定义的参数列表,而且不能显式创建 arguments 对象。arguments 对象只有函数开始时才可用。
在javascript中,不需要明确指出参数名,就能访问它们。如:
用arguments[0]可以访问第一个参数,如此类推。
functionName.caller调用方法的方法内容 arguments.callee被调用的方法内容
arguments是进行函数调用时,除了指定的参数外,还另外创建的一个隐藏对象。Arguments是一个类似数组但不是数组的对象,说它类似数组是因为其具有数组一样的访问性质及方式,可以由arguments[n]来访问对应的单个参数的值,并拥有数组长度属性length。还有就是arguments对象存储的是实际传递给函数的参数,而不局限于函数声明所定义的参数列表,而且不能显式创建 arguments 对象。arguments 对象只有函数开始时才可用。
在javascript中,不需要明确指出参数名,就能访问它们。如:
function hi(){if(arguments[0]=="andy"){ return;}alert(arguments[0]);}
用arguments[0]可以访问第一个参数,如此类推。
functionName.caller调用方法的方法内容 arguments.callee被调用的方法内容
function testFunction(){//可以不命名参数 而得到参数内容if(arguments[0]=='111'){alert('w');}if(arguments[0]=='222'){alert('x');}//返回谁调用了该函数 就是function(){} 匿名函数alert(testFunction.caller);//该函数本身的代码 alert(arguments.callee);}
0 0
- js arguments和caller,callee
- JS Function.caller 和 arguments.callee学习
- arguments.callee 和 caller
- arguments,callee和caller
- JavaScript -arguments、caller 和 callee
- js arguments.caller arguments.callee分析
- js中的arguments,caller,callee,apply
- js中的arguments,caller,callee,apply
- js中的arguments,caller,callee,apply
- js arguments.callee.caller.…
- JavaScript的arguments、caller和callee
- JavaScript 之arguments、caller 和 callee 介绍
- JavaScript 之arguments、caller 和 callee
- JavaScript 之arguments、caller 和 callee 介绍
- JavaScript 之arguments、caller 和 callee 介绍
- JavaScript 之arguments、caller 和 callee 介绍
- JavaScript 之arguments、caller 和 callee 介绍
- arguments,callee&caller
- lua之 unpack
- 【通用】 使用 try catch 处理异常
- Java多线程-对歌式互动-Lock-Condition
- MySQL checksum了解
- js call和apply方法的了解
- js arguments和caller,callee
- mysql 常见函数总结
- Nginx-------Nginx的安装和多域名配置
- redis 安装
- Maven学习:常用mvn命令
- 每天一个Linux命令(31):du
- Maven scope含义的说明
- js RegExp对象学习结合字符串replace方法使用
- 判断字符串是否包含某个子字符串的方法