JSFiddle - React, Tailwind, and code Playground

by amatiasq

HTML

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

JavaScript

function $new() {
    var instance = Object.create(this);
    instance.constructor.apply(instance, arguments);
    return instance;
}

var Vector = {
    new: $new,
    constructor: function(x, y) {
        this.x = x;
        this.y = y;
    },
};

var Cell = {
    new: $new,
    constructor: function(row, col) {
        this.position = row + '-' + col;
    }
};

console.log(Vector.new());
console.log(Cell.new());