function person(name,age,sex){var o=new Object();
o.name=name;
o.age=age;
o.sex=sex;
o.sayName=function(){console.log(name);
}return o;
}var haj=person("haj",29,"M");
haj.sayName();//hajhaj.name="haj1";
haj.sayName();//hajconsole.log(haj.name);//haj1
添加回答
举报
0/150
提交
取消