Off the top of my head, you lose the functionality of hasOwnProperty()
, which can be useful if you are ever doing a for ... in
loop on your object. Consider these two objects:
function MyObject() { ... }
MyObject.prototype.someProperty = 1;
var a = new MyObject();
var b = new MyObject();
b.someProperty = 2;
a.hasOwnProperty("someProperty"); // false
b.hasOwnProperty("someProperty"); // true
That may or may not matter for your situation.
Edit: Thought of another one. If you store objects in your prototype and an instance of that object changes a property on that object, it will affect all other instances:
http://jsfiddle.net/BbmgP/
function MyObject() { ... }
MyObject.prototype.someProperty = { value: 1 };
var a = new MyObject();
var b = new MyObject();
b.someProperty.value = 2;
a.someProperty.value; // 2!! not 1