我想知道我们是否可以在JavaScript中重载原型对象上的函数?
function Person(name, family) {
this.name = name;
this.family = family;
}
Person.prototype.getFull = function() {
return this.name + " " + this.family;
};
Person.prototype.getFull = function(someParam) {
return this.name + " " + this.family;
};
var p = new Person();
p.getFull();
p.getFull(someparam);