time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

repl.txt (923B)


      1 
      2 {{alias}}( ctor, superCtor )
      3     Prototypical inheritance by replacing the prototype of one constructor with
      4     the prototype of another constructor.
      5 
      6     This function is not designed to work with ES2015/ES6 classes. For
      7     ES2015/ES6 classes, use `class` with `extends`.
      8 
      9     Parameters
     10     ----------
     11     ctor: Object|Function
     12         Constructor which will inherit.
     13 
     14     superCtor: Object|Function
     15         Super (parent) constructor.
     16 
     17     Returns
     18     -------
     19     out: Object|Function
     20         Child constructor.
     21 
     22     Examples
     23     --------
     24     // Create a parent constructor:
     25     > function Foo() { return this; };
     26     > Foo.prototype.beep = function beep() { return 'boop'; };
     27 
     28     // Create a child constructor:
     29     > function Bar() { Foo.call( this ); return this; };
     30 
     31     // Setup inheritance:
     32     > {{alias}}( Bar, Foo );
     33     > var bar = new Bar();
     34     > var v = bar.beep()
     35     'boop'
     36 
     37     See Also
     38     --------
     39