JSFiddle - React, Tailwind, and code Playground
by amatiasq
HTML
<script src="http://blog.amatiasq.com/fiddle-console.js"></script>
JavaScript
function Vector(x, y) {
this.x = x;
this.y = y;
}
Vector.prototype.toString = function() {
return 'Vector [' + this.x + ',' + this.y + ']';
};
function fakeNew(Constructor, params) {
var instance = Object.create(Constructor.prototype);
Constructor.apply(instance, params);
return instance;
}
var v = fakeNew(Vector, [0, 0]);
console.log(v);