class method Object.extend

View source on GitHub →

Object.extend(destination, source) → Object
  • destination (Object) – The object to receive the new properties.
  • source (Object) – The object whose properties will be duplicated.

Copies all properties from the source to the destination object. Used by Prototype to simulate inheritance (rather statically) by copying to prototypes.

Documentation should soon become available that describes how Prototype implements OOP, where you will find further details on how Prototype uses Object.extend and Class.create (something that may well change in version 2.0). It will be linked from here.

Do not mistake this method with its quasi-namesake Element.extend, which implements Prototype's (much more complex) DOM extension mechanism.