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 Object-Oriented JavaScript (2015) Practice Project Object-Oriented JavaScript Review

amadeo brands
amadeo brands
15,375 Points

Qwestion help

function Player() { this.health = 100; }

Player. ........... .pickUpHealth = function() { this.health++; }

Can seem to get it ... I thougt it sould be Player.health.pickUpH....

2 Answers

Steven Parker
Steven Parker
231,269 Points

Jason! :disappointed: Tsk!

This is a method being added to a constructor function. The property that does this is prototype.

You might want to re-watch the Methods with Prototypes video where this concept is explained.

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

Wow. "Tsk!" indeed. :persevere:

I knew my JavaScript was rusty, but that was quite the oversight on my part. Thanks Steven. I will definetly be reviewing the whole course this week.

insert face-palm emoji here

:)

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hmm...

Your answer does seem correct to me as well. But, I've be away from JavaScript for a while. So, asking Andrew Chalkley for assistance. :)

Question # 6 on this quiz