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(this, arguments);
return instance;
}
function VectorConstructor(x, y) {
this.x = x;
this.y = y;
}
var Vector = VectorConstructor.prototype;
Vector.new = $new;
var vector = Vector.new(2, 3);
console.log(vector.x);
function PersonConstructor() { }
PersonConstructor.prototype.sayHi = function() {
console.log('Hi all!');
};
var Person = PersonConstructor.prototype;
Person.new = $new;
var bob = Person.new();
bob.sayHi();