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

Yohan Aton
Yohan Aton
1,738 Points

Not sure what the challenge is looking for

Hi, thanks for taking a sec.

I've tried a few solutions but I don't think I understand what the challenge is looking for as an answer. If you can share the solution, I can see it and reverse engineer / understand it.

Thank You!!!

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

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

2 Answers

The challenge is asking that you create to properties to the contact object and then remove the variables from the fullName function.

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

I hope this helps.

Yohan Aton
Yohan Aton
1,738 Points

Thanks Chyno, I understand the syntax, just would not have figured out what is being looked for from the question. Thank You!