I have defined a base object as follows:
var Human = function() {
this.isTalkative = true;
}
I created a method intended for all derived objects:
Human.prototype.introduce = function() {
if (this.isTalkative) {
console.log('Hello, my name is ' + this.fullName);
}
}
Next, I created a derived object, ‘TeamMember’:
var TeamMember = function(fullName, role) {
Human.call(this);
this.fullName = fullName;
this.role = role;
}
Upon instantiation:
var joe = new TeamMember('Joe Smith', 'Web Designer');
doe.introduce();
However, I’m encountering an error: Uncaught TypeError: joe.introduce is not a function
. What might be the issue here?