Question: Here I attempted to create a package called com.matogen.ght with a class in it, Calendar. I'd like the init() method to be called automatically when I instantiate the calendar object. The example below works, but I still have to explicitly call the init() method.

```
var com = {
    matogen : {
        ght : {
            'Calendar' : function() {       

                this.init = function() {
                    console.log("This is my constructor");
                }

            }
        }
    } 
}

$(document).ready(function() {
    var cal = new com.matogen.ght.Calendar();
    cal.init();

});

```

Answer: 
just change your `init` function like so

```
this.init = (function() {
    console.log("This is my constructor");
}());

```

with a self executed anonymous function or, if you prefer, just call the function itself like so

```
...
    Calendar : function() {       

        this.init = function() {
            console.log("This is my constructor");
        };
        this.init();
    }
...

```
Well, as you are doing ***`new`***`com.matogen.ght.Calendar()`, `Calendar()` *is* your constructor. 

So:

```
var com = {
    matogen : {
        ght : {
            Calendar : function() {       
                console.log("This is my constructor");
            }
        }
    } 
}

```

... would be accurate.