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
Written by Agam
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Js
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#