//Repackage the document object
var Console={
Write:function(msg){alert(msg);}
};
//Person object
var Person={
_name:"zzl", //static public
_age :28,
PrintInfo:function(){Console.Write("name:" Person._name ",age:" this._age);} //public method, this means Person
};
//People type (object)
var People=(function()
{
var _name="zzl";//private
var _age=28;
return { //public
PrintInfo:function(){Console.Write("name:" _name ",age:" _age);}
}
}
());
Person.PrintInfo();//Methods in the object
People.PrintInfo();//Public sub-methods in the method object
Console.Write(Person._name);//Attributes in the object