> 
> **Possible Duplicate:**  
> 
> [Strange JavaScript syntax like this: (function(){//code}) ();?](https://stackoverflow.com/questions/1340867/strange-javascript-syntax-like-this-function-code) 
> 
> 
> 

it is like this:

```
(function () {
//codes here
})();

```

here is an example:

```
(function () {
    var D = TED.EditorCore,
        E = TED.extend,
        A = TED.EditorInstanceManager,
        B = TED.augmentObject;
    window.TED["SimpleEditor"] = C;

    function C(F) {
        C.superclass.call(this, F)
    }
    C.defaultConfig = {
        height: "100px",
        width: "400px",
        //blablabla...
        flashNumLimit: 10,
        didaDelay: 300,
        imageWidthLimit: 570
    };
    E(C, D, {
        getContentLength: function () {
            return Math.ceil(this.filteHTML(this.editArea.innerHTML, ["img", "br"]).replace(/<img[^>]*>/gi, "mm").replace(/<br[^>]*>/gi, "m").replace(/&nbsp;/gi, "m").replace(/[^\x00-\xff]/g, "mm").length / 2)
        },
        filteEditHTML: function () {
            return html = this.editArea.innerHTML.replace(/_moz_dirty=""/gi, "").replace(/\[/g, "[[-").replace(/\]/g, "-]]").replace(new RegExp("<\\/?(?:br[^>]*)>", "gi"), "[$1]").replace(new RegExp('<span([^>]*class="?at"?[^>]*)>', "gi"), "[span$1]").replace(new RegExp('<img([^>]*class="?(?:' + this.config.emptyClassName + "|" + this.config.smileyClassName + ')"?[^>]*)>', "gi"), "[img$1]").replace(/<[^>]*>/g, "").replace(/\[\[\-/g, "[").replace(/\-\]\]/g, "]").replace(new RegExp("\\[(/?(?:br|img|span)[^\\]]*)\\]", "gi"), "<$1>")
        },
        filteSubmitHTML: function () {
            this.reLayout();
            var G = this.editArea.innerHTML.replace(/_moz_dirty=""/gi, "").replace(/\[/g, "[[-").replace(/\]/g, "-]]").replace(new RegExp("<(/?(?:" + this.submitValidHTML.join("|") + ")[^>]*)>", "gi"), "[$1]").replace(new RegExp('<img([^>]*class="?(?:' + this.config.imageClassName + "|" + this.config.smileyClassName + "|" + this.config.flashClassName + "|" + this.config.musicClassName + ')"?[^>]*)>', "gi"), "[img$1]").replace(/<[^>]*>/g, "").replace(/\[\[\-/g, "[").replace(/\-\]\]/g, "]").replace(new RegExp("\\[(/?(?:" + this.submitValidHTML.join("|") + "|img)[^\\]]*)\\]", "gi"), "<$1>");
            var F = document.createElement("div");
            F.innerHTML = G;
            this.parseURL(F);
            return F.innerHTML
        }
    });
    B(C, A)
})();

```

what exactly does `(function (){})();` do?