The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Revealing Module Pattern Inheritance Reply To: Revealing Module Pattern Inheritance

NS.AlternateHelloModule = function(){
    var helloModule = NS.HelloModule();
    helloModule.sayHi = function(){
        console.log("well hello agian");
    return helloModule;

Or, if you want more inheritance:

return Object.assign( 
    Object.create( NS.HelloModule ),
    { sayHi: function(){ /* … */ } } 

Object.assign is ES6 but it’s easy to polyfill. It’s basically jQuery’s .extend method.

more here