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

Challenge Task 2 of 2

Challenge Task 2 of 2

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".

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

2 Answers

Aman Mundra
Aman Mundra
2,755 Points

Just as a tip, please try searching the forum for an existing answer to your question before you post one yourself.

This question was already asked (see: https://teamtreehouse.com/forum/i-dont-understand-the-question-5)

Aman Mundra
Aman Mundra
2,755 Points

They're asking for you to make the function anonymous. An anonymous function just means an unnamed function. So you should delete the part of the function that says printFullName.

It should look like this in the end:

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