Tell us what’s happening:
I am working on the challenge “Learn OOP: Understand the Constructor Property”, and my code passes, but I am confused about the result of “false” for the
console.log(joinDogFraternity("tess"));
line. Can someone explain why this is returning “false” and not “true”?
Cheers
Your code so far
function Dog(name) {
this.name = name;
}
// Add your code below this line
function joinDogFraternity(candidate) {
if (candidate.constructor === Dog) {
return true;
} else {
return false;
}
}
let ourDog = new Dog("tess");
console.log(ourDog)
console.log(joinDogFraternity("tess"));
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:72.0) Gecko/20100101 Firefox/72.0
.
Challenge: Understand the Constructor Property
Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property