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.
prototype
properties
The object to inherit from.
Optional
The properties to assign to the object.
Returns the new object.
2.3.0
function Shape() { this.x = 0 this.y = 0}function Circle() { Shape.call(this)}Circle.prototype = create(Shape.prototype, { 'constructor': Circle})const circle = new Circlecircle instanceof Circle// => truecircle instanceof Shape// => true Copy
function Shape() { this.x = 0 this.y = 0}function Circle() { Shape.call(this)}Circle.prototype = create(Shape.prototype, { 'constructor': Circle})const circle = new Circlecircle instanceof Circle// => truecircle instanceof Shape// => true
Creates an object that inherits from the
prototype
object. If aproperties
object is given, its own enumerable string keyed properties are assigned to the created object.