Variables in javascript vs namespacing -
Variables in javascript vs namespacing -
what's downside of using object properties variables in javascript? not add together level of namespacing (effectively)?
var myprop = something;
vs
var myobj = {}; myobj.myprop = something;
actually it's mutual wrap code in 'modules' , utilize objects sort of namespacing. example:
var foomodule = (function(){ var private = 3; var privatemethod = function(){}; var exports = {}; exports.foo = function(){ alert("i public! private is: " + private); } homecoming exports }); alert(private); // throws error foomodule.foo(); //works
javascript variables properties
Comments
Post a Comment