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 Object Basics Creating Object Literals

I can't find an object literal called Play()

I can't figure this out I've watched the intro again and again and I still don't know how to pass it . Is there someone who can help me?

object.js
const player1 = {
name: ' ha',
  color: 'no',
  isTurn: true,
  confused: play(){}

}

1 Answer

Steven Parker
Steven Parker
230,946 Points

The challenge says "Add an empty method to the object literal called play()." But this code is adding something named "confused" instead.

At 2:07 in the Object-Oriented JavaScript video, you'll see an example of a method named bark() added to an object literal. What you need for the challenge is very similar other than yours will have a different name and empty contents (nothing between the braces).