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 Adding a Method to an Object

Jack Cummins
Jack Cummins
17,417 Points

I like to give out best answers! Please answer this question in a helpfull way and then I will give you a best answer!

If you haven't done so already, make the fullName method an anonymous function. If you've done this step already you can "Check Work". Why do I not pass that. It says now that task 1 is no longer passing, but why?

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

1 Answer

Stuart Wright
Stuart Wright
41,118 Points

Almost perfect, you've just got an extra semi-colon (the second to last semi-colon in your code, at the end of the function block).

Delete that and you're good to go.

Edit to add: The reason it says task 1 no longer passing is because the syntax error you've introduced means that the code isn't executed properly. Task 1 no longer passing usually means this in Treehouse challenges, although not all the time.