标签:style blog io ar color sp on div log
用于存储和访问函数参数的参数对象
公共属性:
1. callee:Function 当前正在执行函数的引用。
2. length:Number 参数数目。
递归函数尽量采用arguments,防止函数名有变化,导致错误。
function factorial(num){ if(num == 1) return 1; else return num * arguments.callee(num - 1); } document.write(factorial(10));
arguments 参数存储为数组元素
第一个为 arguments[0], 第二个 arguments[1], ...
function print(str){ document.write(arguments[0]); // Hello the world } print("Hello the world");
or
(function print(str){ document.write(arguments[0]); // Hello the world })("Hello the world");
标签:style blog io ar color sp on div log
原文地址:http://www.cnblogs.com/lcw5945/p/4146496.html