我在閱讀facebook javascript SDK,當我看到以下我不明白的語法: (function(){...}()); 有誰知道它是做什麼的?它是做什麼的? (功能(){...}());
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({appId: 'your app id', status: true, cookie: true,
xfbml: true});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
可能重複的[javascript函數與(function(){...}());](http://stackoverflow.com/questions/4806150/javascript-function-vs-function) –