JSFiddle - React, Tailwind, and code Playground
by amatiasq
HTML
<script src="http://amatiasq.com/fiddle-console.js"></script>
JavaScript
var Type = {
new: function() {
var instance = Object.create(this);
instance.constructor.apply(instance, arguments);
return instance;
},
constructor: function(name) {
this.name = name;
}
};
var instance = Type.new('bob' );
console.log(instance.name);