Say I have defined a Constructor and a prototype in Javascript like this:
MyGame.Player = function(){
this.somevar = 42;
};
MyGame.Player.prototype = {
somevar: null,
someFunc: function(){}
};
What will happen if I do the following:
MyGame.Player.Helper = function(){...}
MyGame.Player.Helper.prototype = {...}
- Will javascript allow this actually?
- Will the Helper appear as ownProperty in an instance of MyGame.Player() ?
- Can I always create new Helper objects even if I don't have a Player object?