function Person() {} Person.prototype.name="Nicholas"; Person.prototype.age=27; Person.prototype.job="teacher"; Person.prototype.sayName=function () { alert(this.name) }; var person1=new Person(); var person2=new Person(); person1.name="greg";alert(person1.name);alert(person2.name);//关于functiong Person{},后面的那个括号不在"teacher";后面,很疑惑请教一下大家?
添加回答
举报
0/150
提交
取消