Can I define a property within an object prototype (method)?
问题 Question part 1: I've made an object constructor with properties in it, but I am wondering if I could define another property of the object within one of it's methods. For example: var Player = function(p1) { this.property1 = p1; this.property2 = 0; } then, can I define this.property3 in a method, like: Player.prototype.drawMethod = funtion() { this.property3 = 1; } and have it accessible, like: var obj = new Player(true); if (obj.property3 ===1 && obj.property1 === 1) { //code } else { obj