SayHello

Trying to create a shortcut to a constructor

by Pierre

JavaScript

var App = {};

(function(that){

    that.SayHello = function(){
        console.log( arguments );
        return {
            doSomething: function(){
                console.log('done');
            }
        };
    };

    var obj = {
        t: new that.SayHello( 'a', 1 ),
        r: new that.SayHello( 'b', 2 ),
        b: new that.SayHello( 'c', 3 ),
        l: new that.SayHello( 'd', 4 )
    };
    
    /*
    var Greet = function(){
            return new that.SayHello;
        },
        obj = {
            t: Greet( 'a', 1 ),
            r: Greet( 'b', 2 ),
            b: Greet( 'c', 3 ),
            l: Greet( 'd', 4 )
        };
    */

}(App));