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

I think I'm having trouble understanding a question in the code challenge.

I'm not sure what an empty is statement is.

object.js
const player1 = {
    name: 'Ashley',
    color: 'purple',
    isTurn: true,
    play: function(){
      if (player1.isTurn){ }
        // write code here.
    }
}

1 Answer

Rohald van Merode
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Rohald van Merode
Treehouse Staff

Hey Lars Johansen 👋

Looks like your interpretation of an empty if statement is the same as expected in this challenge, a conditional without a block of code to run when the condition is met 😄

To pass the challenge however you'll want to have a look at the condition that you've created. Instead of specifically targeting the player1 object the challenge is expecting the use of the this keyword 🙂

Hope this helps!

I figured it out, but there wasn't any knowledge about using the 'this' keyword in the video's before the code challenge. You might consider changing the code challenge to reflect this in the future. BR Lars