JSFiddle - React, Tailwind, and code Playground

by Vitaliy

HTML

<div id = "wrap"></div>

JavaScript

function Person(name){
    this.speak = function(){ alert(name); }
}; 
function create(text, src, alt, className, id){
    this.image = function(){
    var img = document.createElement('IMG');
    img.src = src, img.alt = alt;
    className ? img.className = className : false;
    id ? img.id = id : false; 
    return img;
    }    
}
NEW = function(constr, args) {
    var ist = {};
    ist.prototype = Object.create(constr.prototype);
    ist.prototype.constr = ist;
    constr.apply(ist,args);
    return ist;
 
    
};

var alex = NEW(Person, ['Alex']);
var img = NEW(create, ['', 'http://i.dailymail.co.uk/i/pix/2014/10/06/1412613364603_wps_17_SANTA_MONICA_CA_AUGUST_04.jpg', 'grumpy cat']).image()

document.getElementById('wrap').appendChild(img);