Options
All
  • Public
  • Public/Protected
  • All
Menu

Module create

Index

Functions Object

Object Functions

  • default(prototype: any, properties: any): any
  • Creates an object that inherits from the prototype object. If a properties object is given, its own enumerable string keyed properties are assigned to the created object.

    since

    2.3.0

    example

    function Shape() { this.x = 0 this.y = 0 }

    function Circle() { Shape.call(this) }

    Circle.prototype = create(Shape.prototype, { 'constructor': Circle })

    const circle = new Circle circle instanceof Circle // => true

    circle instanceof Shape // => true

    Parameters

    • prototype: any

      The object to inherit from.

    • properties: any

    Returns any

    Returns the new object.