JSFiddle - React, Tailwind, and code Playground

by gabrieleromanato

JavaScript

function extend(target, source) {
    var hasOwnProperty = Object.prototype.hasOwnProperty;
    for (var propName in source) {
        if (hasOwnProperty.call(source, propName)) {
            target[propName] = source[propName];
        }
    }
    return target;
}


var A = {
    test: 'Test'
};

var B = new function() {
    this.sample = 'OK';
}();

var C = extend(A, B);
var D = extend({alert: 'Message'});

alert(C.test + ' ' + C.sample + ' ' + D.alert); // 'Test OK Message'