<script>
function Person(name, age, sex) {
var a = 0;
this.name = name;
this.age = age;
this.sex = sex;
function sss() {
a++;
console.log(a);
}
this.say = sss;
}
var oPerson = new Person();
oPerson.say(); //1
oPerson.say(); //2
var oPerson1 = new Person();
oPerson1.say(); //1
</script>
js闭包、对象综合练习
最新推荐文章于 2024-07-15 17:15:41 发布