<script type="text/javascript">
function Person(name, age, gender) {
this.name = name;
this.gender = gender;
this.age = age;
}
Person.prototype.sayHi = function(){
alert('我是' + this.name + '今年' + this.age + '我是' + this.gender + '生');
}
var wmm = new Person('王明明', 18, '女');
wmm.sayHi();
Person.prototype.class = '鸳鸯二班';
Person.prototype.school = '北京小学';
Person.prototype.friends = ['王大力', '李小璐', '蔡明明'];
var wlc = new Person('旺理财', 5, '男');
wlc.class = '法拉利班';
alert(wlc.class);
var lct = new Person('理财添', 2, '女');
alert(lct.class);
lct.friends[0] = '我是谁';
lct.friends[1] = '我在哪';
alert(lct.friends);
alert(wlc.friends);
lct.friends = ['再看看', '谁变了', '谁没变'];
alert(lct.friends);
alert(wlc.friends);
</script>