New to JS and i'm having trouble figuring out how to run the constructor of newly created objects.
var player = new Player();
alert(player.getPosition()); // [ undefined, undefined ]
function Player()
{
//afaik the x & y vars should fill when creating a new Player object.
var x = Math.floor((Math.random() * 800) + 1),
y = Math.floor((Math.random() * 800) + 1);
}
Player.prototype.getPosition = function()
{
return [this.x, this.y];
}