JSFiddle - React, Tailwind, and code Playground

by GlauberRocha

JavaScript

/* http://www.youtube.com/watch?v=DwYPG6vreJg (32:12) */


function gizmo(id, secret) {
    secret = secret || {};
    secret.id = id;
    return {
        toString: function() {
            return "gizmo " + secret.id;
        }
    };
}

function hoozit(id) {
    var secret = {},
        /* final */
        that = gizmo(id, secret);
    that.test = function(testid) {
        return testid === secret.id;
    };
    return that;
}


var a = hoozit(5);
console.log(a);