在js中实现匿名函数的递归使用:arguments.callee(),注意:js是区分大小写的
例子:
var count = 0;
(function()
{
if(count<10)
{
console.log(count+"callee");
}
count++;
arguments.callee();//递归
})();
在运行上面脚本后,可以在控制台中看到如下的结果:
在js中实现匿名函数的递归使用:arguments.callee(),注意:js是区分大小写的
例子:
var count = 0;
(function()
{
if(count<10)
{
console.log(count+"callee");
}
count++;
arguments.callee();//递归
})();
在运行上面脚本后,可以在控制台中看到如下的结果: