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 Filling Out the Play Method

gladys padilla
gladys padilla
7,909 Points

Can someone explain to me what I did wrong, please? I keep getting a "unexpected end input" bummer

I've been stuck on this for a long minute

object.js
const player1 = {
    name: 'Ashley',
    color: 'purple',
    isTurn: true,
    play: function(){
       if (this.isTurn) {
        const player1 = { name: 'Ashley',
                          color: 'purple',
                          isTurn: true,
                          play: function(){ 
                            if (this.isTurn){
                              return player1 ['name'] + ' is now playing!'
       }
    }
}

2 Answers

Alex Koumparos
seal-mask
.a{fill-rule:evenodd;}techdegree
Alex Koumparos
Python Development Techdegree Student 36,887 Points

Hi Gladys,

Part of your problem is that your braces are unbalanced: you have a few more opening braces than closing braces.

The bigger problem is that you are defining a new local constant inside your if statement when all you are being asked to do is return the string described in the challenge text.

Hope that helps

Cheers

Alex

gladys padilla
gladys padilla
7,909 Points

THANK YOU SO MUCH! Sometimes it just takes another set of eyes!