1 function Human(name, sex) {
 2             this.name = name;
 3             this.sex = sex;
 4             if (typeof this.say != "function") {
 5                 Human.prototype.say = function () {
 6                     alert(this.name);
 7                 }
 8             }
 9         }
10         var man =new Human ("凯撒", "男");
11         man.say();

 

相关文章:

  • 2021-04-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-05
  • 2022-12-23
  • 2021-07-14
  • 2021-12-18
  • 2021-05-10
猜你喜欢
  • 2022-01-01
  • 2021-11-09
  • 2022-12-23
  • 2022-03-03
  • 2022-03-03
  • 2021-06-06
相关资源
相似解决方案