JSFiddle - React, Tailwind, and code Playground

by gschutz

JavaScript

var Foo = function() {
    var per = "tudo";
    var that = {};
    var elem;
    
    that.gizmoo = function(i, callback) {
        //console.log(id);
        elem = $('<div>Olá:'+i+'</div>').appendTo('body').click(callback);
        return that;
    }
    
    that._click = function(callback) {
        //elem.click(callback);
        //callback(this);
        
        return that;
    }
    
    return that;
}


var giz = [0,1,2,3];

var foo = Foo();

for( var i = 0; i < giz.length; i++) {
    foo.gizmoo(i, function(obj){
        console.log(":"+i);
    });
    
}