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

Manpreet Singh
Manpreet Singh
13,014 Points

Confussion in the question

what question want from me to do

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

2 Answers

Steven Parker
Steven Parker
231,275 Points

This should pass task 1.

And for task 2, all you do is make the function "anonymous", which just means removing the function name. So there will be nothing between the word "function" and the parentheses "()".

nico dev
nico dev
20,364 Points

I guess you refer to the second part of the challenge because it seems you've done the first part fine.

An anonymous function is a function that does not have a name, or in other words :

x: function() {
    function code here
}

So all you have to do is just removing the name (i.e.: the printFullName bit) to make it anonymous.

Manpreet Singh
Manpreet Singh
13,014 Points

can you please send me the full code