Use Prototype Properties to Reduce Duplicate Code - Object Oriented Programming - Free Code Camp

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

Thank you for your lesson Mr. Ian I'm really getting the just of things each and every day sir.
Dog.prototype.numLegs = 4;
console.log(beagle.numLegs); and my answer is then 4.

zken
Автор

I still dont understand the difference between using the prototype and just using this.numLegs = 4. From my understanding, wont this.numLegs have the same effect when creating an instance from theDog() constructor? All the instances will display the 4 legs prop right?

Thanks for the vids, big help.

jonathanrojas
join shbcf.ru