Last Updated: February 25, 2016
·
382
· agam360

JavaScript Private Variable

var test = (function(){
    var public, private;
    private = 43;
    public  = {}
    public.num = 42;

    return public;
}());

console.log(test);
console.log(private);//Uncaught ReferenceError: private is not defined