Possible Duplicate:
JavaScript: Class.method vs. Class.prototype.method
What's the difference between creating a prototype like this:
Date.foo = function(bar) {
alert(bar);
};
And this:
Date.prototype.foo = function(bar) {
alert(bar);
};
Why/when should I use either?