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!
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

Stephan Hoeksema
16,567 PointsAdd an empty method to the object literal called play(). WHat do you mean? player1.play()???
Do you want to insert an method to the object?
const player1 = {
name: 'Jip',
color: 'GreyishBrown',
isTurn: true
}
player1.play()
9 Answers

Andreas Nyström
8,886 PointsHi.
To do this you want to put the function inside the object literal. With the property of play and then a function as value. If you don't get it after you complete it, rewatch the video again.
const player1 = {
name: 'NameHere',
color: 'ColorHere',
isTurn: true,
play: function(){}
}

Seth Johnson
15,197 PointsThe wording of these instructions isn't very well done, or it's a deliberate misdirection, I'm not quite sure which. Also, apparently trying to put an arrow function (which I thought was encouraged as per all of the ES2015 videos?!) doesn't work either. : /

Gabriel C. Cavallo
4,438 PointsI agree

Caleb Spindler
11,397 Pointsplay: function(){}
That does the trick! The brackets after "play" in the question made me a little confused at first. After rewatching the video, I realized that she said, "The property key is the name of the method, and that's the name you'll use when you want to call it."
In the end, one is able to create a method, e.g., play(), by using the method's name as an object property.

af09
10,704 PointsInside the object literal add the play method
const player1 = {
name: 'Jip',
color: 'GreyishBrown',
isTurn: true,
//play method
}

Salwa Elmohandes
Full Stack JavaScript Techdegree Graduate 20,240 Pointsplayer1.play=" ";

Jason Costa
7,854 PointsI found this quite difficult as well. The instructions were a little misleading for a student.

Jasper Kop
10,313 Pointshow could I know the answer for this question?

Dheerendra Singh
2,390 Pointsconst player1 = { name : 'abhinav', color: 'Dark', isTurn: true, play: function (player1) {}
}

Rana Dugal
9,506 Pointsconst player1 = { name: 'rana', color: 'brown', isTurn: true, play: function() { } }