“there are a couple of problems with our bio() method — the output always includes the pronoun “He”, even if your person is female”
Hi, im trying to do the first part of this task which is to replace the pronoun based on gender. I came up with a simple solution which in my mind makes sense, but doesnt work, can someone explain why it doesnt?
function Person(first, last, age, gender, interests) {
this.name = {
first,
last
};
this.age = age;
this.gender = gender;
this.interests = interests;
this.bio = function() {
var maleBio = ’ years old. He likes '
if (this.gender === “female”) {
maleBio.replace(“He”, “She”)
}
alert(this.name.first + ’ ’ + this.name.last + ’ is ’ + this.age + maleBio + this.interests[0] + ’ and ’ + this.interests[1] + ‘.’);
};
this.greeting = function() {
alert('Hi! I’m ’ + this.name.first + ‘.’);
};
}
var person1 = new Person(“Katrina”, “Ballerina”, 29, “female”, [“boxing”, “ballet”])
Thank you!