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 trialSophie Creutz
501 Pointsplay: function(){ if (this.isTurn === true) Why is this wrong?
play method. what is it asking that this does not fulfill?
const player1 = {
name: 'Ashley',
color: 'purple',
isTurn: true,
play: function(){
if (this.isTurn === true){
}
}
}
2 Answers
Sean T. Unwin
28,690 PointsSyntactically your code is correct, albeit a little redundant as isTurn
is a boolean so it's going to return true
or false
anyway so really all you need is if (this.isTurn) {}
.
There is likely something in the Challenge run-time code which explicitly is looking for a concise if
statement or similar.
Good luck on the rest of the course!
hombah
Python Web Development Techdegree Student 16,241 Pointsas Sean T. Unwin mentioned
const player1 = {
name: 'Ashley',
color: 'purple',
isTurn: true,
play: function(){
if (this.isTurn) {
}
}
}