I wanted to know if we can overload a function on prototype object in 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);
No comments:
Post a Comment