I see this code in MV
Object.defineProperty(Game_Actor.prototype, 'level', {
get: function() {
return this._level;
},
configurable: true
});
Whereas, I could simply define a method myself that does the same thing
Game_Actor.prototype.level = function() {
return this._level;
};
For me, the obvious difference is in usage
myActor.level // first way
myActor.level() // second way
Is there an advantage to defining getters using the get keyword other than NOT having to type some extra parentheses?
Object.defineProperty(Game_Actor.prototype, 'level', {
get: function() {
return this._level;
},
configurable: true
});
Whereas, I could simply define a method myself that does the same thing
Game_Actor.prototype.level = function() {
return this._level;
};
For me, the obvious difference is in usage
myActor.level // first way
myActor.level() // second way
Is there an advantage to defining getters using the get keyword other than NOT having to type some extra parentheses?