Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Chase Lee
Chase Lee
29,275 Points

Websites > JavaScript Foundations > Objects > Prototypes: Part 2

Hey everyone, hope you're doing fine. So I was doing the Prototypes: Part 2 by Jim Hoskins and was changing the species, but it didn't work. Here is what I worte and the results.

Person.prototype.species = 'Human'
"Human"

chase.species
"Homo Sapien"

Person.prototype.favoriteColor = 'red'
"red"

chase.favoriteColor
undefined

1 Answer

chase.species is "Homo Sapien" instead of "Human" so something is already a little off.

function Person(){};
Person.prototype.species = 'Human';
chase = new Person();
chase.species
Person.prototype.favoriteColor = 'red';
chase.favoriteColor

is the minimal code that would work in a Javascript console.