I am new to JavaScript, but not to OOP in general.
Is this a valid way of creating getters & setters in JavaScript?
The "class",
function Person (age){
this.age = age;
};
Getter,
Person.prototype.getAge = function(){
return this.age;
};
and a setter.
Person.prototype.setAge = function(arg){
this.age = arg;
};
It seems to work fine, but I dont know the convention, I get diffrent descriptions everywhere, but is my solution valid?