首先一个最大的问题是,arguments这个对象哪儿来的?也许有人会认为它是调用函数时引擎自带的一个局部变量,因为我们平时使用arguments的时候都是在函数中把它当作局部变量来使用的。事实上arguments是Function实例的属性,只是在调用时候会被作为局部变量来使用而已。这也是这个对象最吸引人的地方。在函数没有运行时我们也可以访问到它,只不过没运行时它的值是null而已。 
 
  
  
  
 
function f(){
   alert(f.arguments==arguments); //true
 };
 alert("arguments" in f); //true
 alert(f.arguments); //null
 f();function join(){
   return Array.prototype.join.call(arguments);
 };
 alert(join("a","b","c"));function max(){
   return Math.max.apply(null,arguments);
 };
 alert(max(5,2,7));(function(a){
   a="我主页";
   alert(arguments[0]); //我主页
 })("测试");function f(){
   alert(arguments.callee===f); //true
 };
 f();(function(){
   console.log("我主页");
   setTimeout(arguments.callee,1000);
 })();转载请注明:前端录»JavaScript的arguments及其子对象
<script src="http://www.wozhuye.com/index.php?m=digg&c=index&a=init&id=20-79-2"></script>