惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

小众软件
小众软件
博客园 - Franky
罗磊的独立博客
G
Google Developers Blog
The GitHub Blog
The GitHub Blog
P
Proofpoint News Feed
Recent Announcements
Recent Announcements
V
V2EX
F
Fortinet All Blogs
阮一峰的网络日志
阮一峰的网络日志
Blog — PlanetScale
Blog — PlanetScale
月光博客
月光博客
U
Unit 42
GbyAI
GbyAI
A
About on SuperTechFans
WordPress大学
WordPress大学
Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
Martin Fowler
Martin Fowler
D
DataBreaches.Net
The Cloudflare Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
MongoDB | Blog
MongoDB | Blog

博客园 - luoluo

各地电信运营商插广告赚钱,北京联通也不甘落后 幻影t-shirt 2010 新年 每天都是GDP CorelDraw工具自动切换到选择工具的问题 要淡定 flash 0day的临时防御 Still Believe 也谈Server Limit DOS的解决方案 发现一篇关于flash垃圾回收机制的文章 开春第一趟单骑上妙峰 杭州归来 IE window对象跨域的一些特性 firebug也支持debugger关键字了 网上流行的JS HTMLDecode不安全 把JS函数转URL形式 看到的一点进步 北京春雪 记忆力衰退
实现JavaScript匿名透明递归
luoluo · 2009-04-20 · via 博客园 - luoluo

什么是匿名透明递归,就是递归调用的时候不需要知道函数名,也不需要理解参数。用到的知识点:

1、arguments对象的callee属性,取得当前函数对象,实现函数匿名引用

2、Function对象的apply方法,调用一个方法,并传入this指针和arguments对象,这样就实现参数透明传递

<script type="text/javascript">
<!--
(
function(s, n, o) {
    alert(n);
if (n < 5) {
        n 
++;
        arguments.callee.apply(
this, arguments);
    }
})(
"test"0, {a : 1});
//-->
</script>