javascript创建对象之动态原型模式(五)时间:2023-03-09 07:27:59 function Human(name, sex) { this.name = name; this.sex = sex; if (typeof this.say != "function") { Human.prototype.say = function () { alert(this.name); } } } var man =new Human ("凯撒", "男"); man.say();