What's the role of the parentheses in the following piece of code?

Posted by Emanuil on Stack Overflow See other posts from Stack Overflow or by Emanuil
Published on 2010-05-30T09:17:46Z Indexed on 2010/05/30 9:42 UTC
Read the original article Hit count: 252

This is the tracking code for Google Analytics:

var _gaq = _gaq || [];
_gaq.push(["_setAccount", "UA-256257-21"]);
_gaq.push(["_trackPageview"]);

(function() {
var ga = document.createElement("script"); ga.type = "text/javascript"; ga.async = true;
ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";
var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ga, s);
})();

You can see that the function is inside parentheses.

Why do you think is that?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about google-analytics