JSFiddle - React, Tailwind, and code Playground

by gschutz

JavaScript

var myBind = function(a1, a2) {
    
    function Wrapper(a, b) {
        this._value_ = a;
        this._clone_ = b;
    }
    
    function Methods() {}
    
    Methods.prototype.add = function(el) {
        this._value_.push(el);
        this._clone_.push(el);
        
        return this;
    }
    
    Methods.prototype.change = function(el) {
        // you get the idea;
        
        return this;
    }
    
    
    Methods.prototype.value = function() {
        return this._value_;
    }
    
    
    Wrapper.prototype = Methods.prototype;
    
    return new Wrapper(a1, a2);
}

var a1 = [1, 2, 3];
var a2 = [3, 4, 6];
var b = myBind(a1, a2);

console.log(b);