function student(name,sex,age){ var privateStore={ name:"张宇", sex:"男", age:"18" }; function _set(){ privateStore.name=this.name; privateStore.sex=this.sex; privateStore.age=this.age; } function _get(){ return '姓名:'+privateStore.name+', 性别:'+privateStore.sex+', 年龄:'+privateStore.age+'<br/>'; } this.get=function(){ return _get; } this.set=function(){ return _set; } } var s1=new student('xh','female','19'); document.write(s1.get()()); s1.set()(); document.write(s1.get()());
添加回答
举报
0/150
提交
取消