JavaScript Inheritance

JavaScript Inheritance study

by ZenMaster

JavaScript

function Shape(x, y) {
    this.x = x;
    this.y = y;
}

var shape1 = Object.create(Shape);

console.log(new Shape(1, 2), new shape1);