//重新封装document对象
var Console={
Write:function(msg){alert(msg);}
};
//Person对象
var Person={
_name:"zzl", //static public
_age:28,
PrintInfo:function(){Console.Write("name:"+Person._name+",age:"+this._age);} //public method ,this表示Person
};
// People类型(对象)
var People=(function()
{
var _name="zzl";//private
var _age=28;
return {//public
PrintInfo:function(){Console.Write("name:"+_name+",age:"+_age);}
}
}
());
Person.PrintInfo();//对象中的方法
People.PrintInfo();//方法对象中的公开子方法
Console.Write(Person._name);//对象中的属性