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 why this is not accepted
I'm supposed to set the value of isTurn to false, and for some reason (maybe this is an archaic method ) this isn't working.
const player1 = {
name: 'Ashley',
color: 'purple',
isTurn: true,
play: function(){
if (this.isTurn) {
console.log(`${this.name} is now playing!`);
this.isTurn=false;
}
}
}
const player2 = {
name: 'Guil',
color: 'red',
isTurn: false,
play: function(){
if (this['isTurn']) {
console.log(`${this['name']} is now playing!`);
}
}
}
1 Answer

Joe Beltramo
Courses Plus Student 22,191 PointsThe instructions are for doing it after the existing code. So you did set the value correctly using dot notation, just in the incorrect spot.
After all the existing code, change the value for player1
/** existing code**/
yourAnswerHere (player1.isTurn = false)
Notice, the need to change from this
to player1
since we are no longer in the scope of the object itself
Stephen Powers
12,091 PointsStephen Powers
12,091 PointsI tried that after I tried "this" for that very reason. After being denied, I then went back to "this" because I didn't understand why that would be separated from the function.
Antti Lylander
9,674 PointsAntti Lylander
9,674 Points