Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

立即执行函数采用什么格式? #3

Open
2betop opened this issue Apr 23, 2014 · 2 comments
Open

立即执行函数采用什么格式? #3

2betop opened this issue Apr 23, 2014 · 2 comments

Comments

@2betop
Copy link
Contributor

2betop commented Apr 23, 2014

目前比较常见的方式有

// 方式1
(function() {
})();

// 方式2
+function() {}();

// 方式3
!function() {}();

经测试方式1最快,所以推荐方式1
http://jsperf.com/bang-function

@nwind
Copy link
Member

nwind commented Apr 24, 2014

方式 1 +1,最常见的了

@miller
Copy link
Contributor

miller commented Apr 25, 2014

赞同多益

@miller miller modified the milestones: pre alpha, 1st edition Apr 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants