JSFiddle - React, Tailwind, and code Playground

by Kriem

JavaScript

function Test(callback) {
    
    this.addCallback = function(callback){
        
        if (this.callback == callback) {
            var same = 666;
            console.log(same);
        } else {
            var same = 000;
            console.log(same);            
        }
       this.callback = callback;   
    }
    this.callback = callback || null;
    this.speak = function(){
       console.log('I speak');   
    }
};
    
    var boe = 10;

var test = new Test();

        test.addCallback( function(){ console.log( boe ) } );
        test.addCallback( function(){ console.log( boe ) } );
                                      
                                      var foo = function(){
                                         var x = 10000000;   
                                          console.log(x);
                                      };
                                      
        
        test.addCallback( foo );
        test.addCallback( foo );
                                       
test.callback();