javascript匿名函数 [英] javascript anonymous function

查看:76
本文介绍了javascript匿名函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

此JavaScript代码段是什么意思?

i想知道为什么双功能支架在功能的最后?

i was wondering why is the double Bracket in the end of the function?

这里是简单的匿名功能:

here is simple of the anonymous function :

(function(){ ... })();

(function(){...})();

(function(){ ... })();

那些用于什么?

推荐答案

这声明了一个匿名函数并调用它立即在同一条线上。可以把它想象成:

This declares an anonymous function and invokes it immediately on the same line. Think of it as:

foo();

其中 foo 表示匿名函数,声明内联,不能用名称引用。

where foo represents an anonymous function which is declared inline and cannot be referenced by a name.

这篇关于javascript匿名函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆