Prototypal inheritance?

Var Foo = { Bar: function() { //... return this; // technically unnecessary, implied by 'new' operator } }; Foo.Bar. Prototype = new Cow(); // the secret sauce dive = new Foo.Bar(); dive.moo(); // moo's like a Cow.

Here is a working example without the Bar constructor jsFiddle.

Thank you for the start, jimbojw! You were close, but you gave me enough information to get it: function Cow() { return { talk: function() { alert("mooo"); } }; } var Foo = { Bar: function() { function result() { alert("Foo. Bar says..."); }; result.

Prototype = new Cow(); return new result; } }; new Foo.Bar().talk().

If you want to encapsulate Foo.Bar. Prototype = you can do it without changing default constructor behavior: function Cow() { this. Talk = function() { alert("mooo") } } var Foo = { Bar: function() { var constructor = function() { this.

Eat = function() { alert("gulp") } } constructor. Prototype = new Cow() return constructor }() } var foo = new Foo.Bar() foo.talk() foo.eat().

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions