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

Arthur Berg
Arthur Berg
11,350 Points

I'm getting Parse Error on this code.. I've tried with and without commas. Nothing works. Any suggestions?

I get parse error, i've tried with and without commas. I've done exactly what the intructions tell me to do. Created 2 new properties and deleted the variable declarations inside the function..

akak
akak
29,445 Points

Please post your code. Hard to tell what's wrong without looking at it.

2 Answers

Ferdinand Pretorius
Ferdinand Pretorius
18,705 Points

Hi Arthur,

Considering the nature of this challenge, and the fact that you clearly modified the semi-colons to commas, my guess is that you didn't turn the equals ( = ) into colons( : )

But to better answer your question, please post your source code or just compare your code to the code bellow:

var contact = {
  firstName : "Andrew",
  lastName : "Chalkley",
  fullName: function() {
    console.log(firstName + " " + lastName);
  }
}

In console.log use this.firstName and this.lastName