JavaScript: Privileged

function powerConstructor() {
    var that = object(oldObject), privateVariable;
    function privateFunction(x) {
        //privateVariable
    }
    
    that.firstMethod = function (a, b) {
         //I can access private values
    };
    
    that.secondMethod = function (c) {
         //I can access private values
    };
}

JavaScript: Private

var singleton = function () {
    var privateVeriable;
    function privatefunction(x) {
        //privateVariable
    }
    
    return { 
        firstMethod: function (a, b) {
            //I can access private values
        },
        secondMethod: function (c) {
            //I can access private values        
        }
    };
}();

Installing Node.js on Ubuntu Server

Guide.

sudo apt-get update
sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
  • 1
  • 2