function Person(name,age){
this.name=name
this.age=age
}
Person.prototype.getName=function(){
return this.name
}
var p1=new Person('aa',12)
var p2=new Person('bb',14)
console.log(p1.name)
console.log(p2.name)
console.log(p1.getName===p2.getName)//true

  

 

相关文章:

  • 2022-01-11
  • 2021-06-25
  • 2021-06-05
  • 2021-11-13
  • 2021-12-25
  • 2021-10-21
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-29
  • 2021-10-10
  • 2021-05-06
  • 2021-06-08
相关资源
相似解决方案