Skip to content
RubyLouvre edited this page May 26, 2012 · 1 revision
        function Human(sgender){
            //private
            this._age = 33;
            this._gender = sgender || "male";
            //public
            this.growup = function(){
                this._age++;
            }

        }

        function Human(sgender){
            //private
            var age = 33, gender = sgender || "male";
            //privileged Method
            this.growup = function(){
                age++;
            }

        }

        function Human(){

            var age = 33, gender = sgender || "male";
            return {
                growUp: function(){
                    age++;
                }
            }
        }
Clone this wiki locally