Dear all,
I am Trong Anh and I am learning javascript object-oriented prototype.I have read your articles but I’m not sure how I get it.
Here is my code:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/object-oriented-programming/use-prototype-properties-to-reduce-duplicate-code
Thank you.
Just a heads up - that link just shows us the challenge, not what you have tried.
Dear Bob Smith,
I’m gonna give you my code.
function Dog(name,numLegs) {
this.name = name;
this.numLegs = numLegs;
}
// Add your code above this line
let beagle = new Dog(“Snoopy”);
beagle.prototype.numLegs = 4;
have you seen this line?
plus, you need to this:
Add a
numLegs
property to theprototype
ofDog