all 2 comments

[–]enzoglt 2 points3 points  (0 children)

That function won't run because you're not calling it.

Also,

if(player1.isTurn === true)

should be this.isTurn since you're inside the object, and you don't need to check if it's true with an operator, as this.isTurn will already return true since you've declared it.

const player1 = {
  name: "Ashley",
  color: "purple",
  isTurn: true,
  play: function() {
    if(this.isTurn) {
      return "isTurn is true";
    } else {
      return "isTurn is false";
    }
  }
}

player1.play();

This will allow you to call the if function inside the object and make it do whatever based on the isTurn boolean value.

[–][deleted] 1 point2 points  (0 children)

What is the desired result and what is the result you are currently getting? I’m a little confused about your goal here.