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();//haj
haj.name="haj1";
haj.sayName();//haj
console.log(haj.name);//haj1
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
小伙看你根骨奇佳,潜力无限,来学PHP伐。