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) Introduction to Methods Understanding this

Not sure what I'm Missing on this assignement

I'm not sure I'm understanding what the question is asking me to do. I've tried everything i can think of and it keeps telling me I'm doing it wrong.

object.js
var contact = {
  this.firstName: "Andrew",
  this.lastName: "Chalkley"};
    console.log(firstName + " " + lastName);
Karalyn Heath
Karalyn Heath
18,033 Points

I think it's the comma after "Andrew" on the second line. It should be a semi-colon.

2 Answers

Andrew Kiernan
Andrew Kiernan
26,892 Points

Hey Matthew!

You are on the right track. For the firstName and lastName properties, you don't need the this keywords. Where you will need it is in the fullName method (your console.log statement will make use of this.firstName and this.lastName).

I hope that helps. Let me know if you have any questions!

Thanks guys! :)