JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://amatiasq.com/fiddle-console.js"></script>

JavaScript

var Vector = {
    new: function() {
        var instance = Object.create(this);
        instance.constructor.apply(instance, arguments);
        return instance;
    },
    
    constructor: function(x, y) {
        this.x = x;
        this.y = y;
    },
        
    toString: function() {
        return '[Vector{' + this.x + ',' + this.y + '}]';
    }
};

var vector3D = Vector.new(0, 0);
vector3D.z = 10;
console.log(vector3D);

var other = vector3D.new(3, 4);
console.log(other);

// property inherited from vector3D
console.log(other.z);