Question : javascript nested classes

I am trying to achieve this OOP style (1 main class with internal classes) but I am getting error "MiniAds is not defined"

<script>    
    new MiniAds.Widget({
      width: 200,
      height: 100
    }).render();    
</script>
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
MiniAds = window.MiniAds || {};

MiniAds.Widget = function (x) {
    this.init(x);
};
    
MiniAds.Widget.prototype = function () {           
    return {
        init : function () {
            alert(1);
            return this;            
        }
        render : function () {
            alert(2);
            return this;            
        }
    };
}

Answer : javascript nested classes

Like this?  Not really sure what you are trying to accomplish.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
var MiniAds = window.MiniAds || {};

MiniAds.Widget = function (x) {
	return this; 
};

MiniAds.Widget.prototype = {
        init : function (p) {
            alert(p);    
        },
        render : function (p) {
            alert(p);           
        }
    };

var w = new MiniAds.Widget('hello');

w.init('foo');
w.render('bar');
Random Solutions  
 
programming4us programming4us