I often see this pattern to define javascript objects
function Person(name) {
this.name = name;
}
Person.prototype.describe = function () {
return \"
Perhaps related: In general modifying an object that you don't own is considered an anti pattern.
Meaning, if you didn't create the object then you don't "own" that object. Including:
window
)Source Maintainable Javascript by Nicholas C. Zakas