Consider the following to JavaScript snippets:
function foo() {
this.bar = function() { };
}
// or... (if we used an empty constructor function)
foo.prot
To add onto the existing answers:
Making a prototype function would allow changes to it to be inherited. i.e if you write
function foo(){}
foo.prototype.bar = function(){return 1};
function baz(){}
baz.prototype = new foo();
new baz().bar(); //returns 1
foo.prototype.bar = function(){return 2};
new baz().bar(); //returns 2
However, putting it in the constructor would let other objects inheriting from it also "have" that function, but the function is not inherited.
function foo(){this.bar = function(){return 1};}
function baz(){}
baz.prototype = new foo();
new baz().bar(); //returns 1
foo.prototype.bar = function(){return 2};
new baz().bar(); //returns 1