var Game = function(){
var game = this;
game.Player = {
pts:[]
}
}
for example in php it could be as:
game.Computer extends game.Player
But how can I do a child from game.Player in javascript in the same class?
[update]
[1]
var Game = function(){
var game = this;
game.Player = {
pts:[],
test: function(){ alert('test'); }
}
Player.prototype = new Computer;
game.Computer = {
}
}
var game = new Game();
game.Computer.test();
I'm not sure @BenM
[update]
[2]
or even like this:
var Game = function(){
var game = this;
game.Player = {
pts:[],
test: function(){ alert('test'); }
}
game.Player.prototype = game.Computer {
}
}
var game = new Game();
game.Computer.test();
That is wrong too, can't extend it as is. Sorry if it's a lot of code here.