The extend
method for example in jQuery or PrototypeJS, copies all properties from the source to the destination object.
Now about the prototype
property, it is a member of function objects, it is part of the language core.
Any function can be used as a constructor, to create new object instances. All functions have this prototype
property.
When you use the new
operator with on a function object, a new object will be created, and it will inherit from its constructor prototype
.
For example:
function Foo () {
}
Foo.prototype.bar = true;
var foo = new Foo();
foo.bar; // true
foo instanceof Foo; // true
Foo.prototype.isPrototypeOf(foo); // true