resource / Front-End-Standards

Front-end development standards for Resource.
MIT License
23 stars 1 forks source link

Provide better example for private properties. #4

Closed LukeAskew closed 10 years ago

LukeAskew commented 11 years ago

"protected" varaibles.

Protect the prototype.

mcgaryes commented 11 years ago

// bad var that = new Object(); that._property = "Nancy";

// good var Test = function(){ this._privateVar = "test";
};

Test.prototype = { funx:function(){ this._privateVar = "foo"; }
};

// bad var test = new Test(); test._privateVar = "test";