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 trialellie adam
26,377 PointsQ 2-5 What argument is missing?
Can't figure it out.
What argument is missing?
function Shape(sides) {
this.sides = sides;
}
function Triangle() {
Shape.call(, 3);
}
Triangle.prototype = Object.create(Shape.prototype);
1 Answer
Jason Anders
Treehouse Moderator 145,860 PointsHey Ellie, The missing argument is "this" -- the why is a whole other story. Basically, you have the Shape constructor that takes one argument (sides), so when you 'call' the Shape in the Triangle function, you are using 'this' to tell Shape what arguments you are calling, (3).
I actually find this kind of confusing and am myself going over it again and again. If you want, Andrew talks a bit about it and why in the 3rd video starting at about 1:15.
Good luck. :) Jason
ellie adam
26,377 Pointsellie adam
26,377 PointsThanks Jason!