Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Stephen Powers
12,091 PointsNot sure what I'm missing here
I'm supposed to write an empty if statement inside play to check if it's the player's turn, and I'm obviously missing something... but can't seem to figure it out.
const player1 = {
name: 'Ashley',
color: 'purple',
isTurn: true,
play: function(){
if (this.isTurn==true){
}
}
}
2 Answers

Alexander Lee
5,964 PointsWhile your solution is not incorrect,
if (this.isTurn) {}
should suffice and also seems to be the answer they're looking for here.

Stephen Powers
12,091 PointsThanks Alexander. I’m a little confused at why that works. Is it because that key has a Boolean value and it’s understood upon calling it?

Alexander Lee
5,964 PointsYes, in Javascript and many other programming languages you can safely omit the ==true part altogether dealing with Booleans as it is implied.