In the following code a constructor function, an object instance, and two examples of changing a functions prototype. What is the difference between these two methods? As far as I can work out the second method will update the object instance even if it is after the declaration of that instance, whereas the other will not. Is this the only difference?
function Foo(name, color) {
this.name = name;
this.color = color;
}
var bar = new Foo('name', 'color');
First method:
Foo.prototype = {age: 6};
Second method:
Foo.prototype.age = 4;`