I often see this pattern to define javascript objects
function Person(name) {
this.name = name;
}
Person.prototype.describe = function () {
return "Person called "+this.name;
};
And in this article it says that adding properties directly to the prototype objct is considered an anti-pattern.
Coming from "classical class based" languages, having to define the properties apart from methods doesn't sound quite right, moreoever in javascript, where a method should be just a property with a function value (am I right here?)
I wanted to know if anybody can explain this, or even suggest a better way to handle these situations