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 trialTiffany White
5,373 PointsI am confused by the instructions here.
Not certain what this is asking: Modify the Monster constructor to take one parameter of name. Inside the constructor function, when it creates a new instance assign the parameter name to the property of name on the new instance.
function Monster (name) {
}
2 Answers
Steven Parker
231,269 PointsRemember that the new instance is referred to as this. So you want something like:
function Monster (name) {
this.name = name;
}
This is very similar to what was done in the video using Dice and sides.
Shane Oliver
19,977 Pointsyou need to add a property on the Monster object of name that is equal to the argument of name
this.name = name;
Tiffany White
5,373 PointsTiffany White
5,373 PointsYeah I figured it out. Thanks for answering the question though.