Help Chore Door - why doesnt my code work?

Hey ,

–> link to exercise: https://www.codecademy.com/paths/web-development/tracks/build-interactive-websites/modules/web-dev-interactive-websites/projects/chore-door <–

I checked my code (and compared it with the video) like a 1000000 times but somehow the doors still won’t open anymore at the at step 57.

Thanks a lot for your help.

here’s my code:

const doorImage1 = document.getElementById('door1');
const doorImage2 = document.getElementById('door2');
const doorImage3 = document.getElementById('door3');

const botDoorPath = "https://content.codecademy.com/projects/chore-door/images/robot.svg";
const beachDoorPath = "https://content.codecademy.com/projects/chore-door/images/beach.svg";
const spaceDoorPath = "https://content.codecademy.com/projects/chore-door/images/space.svg";
const closedDoorPath = "https://content.codecademy.com/projects/chore-door/images/closed_door.svg";
const startButton = document.getElementById('start');
let numClosedDoors = 3;  
let openDoor1;
let openDoor2;
let openDoor3;

const isClicked = (door) => {
  if (door.src === closedDoorPath) {
    return false;
  } else {
    return true;
    }
};

const playDoor = (door) => {
  numClosedDoors--;
  if (numClosedDoors === 0) {
    gameOver("win");
  }
}


const randomChoreDoorGenerator = () => {
  let choreDoor = Math.floor(Math.random()* numClosedDoors);
  if (choreDoor === 0) {
    openDoor1 = botDoorPath;
    openDoor2 = beachDoorPath;
    openDoor3 = spaceDoorPath; 
  }
  else if (choreDoor === 1) {
    openDoor2= botDoorPath;
    openDoor1= spaceDoorPath;
    openDoor3= beachDoorPath;
  }
  else { (choreDoor === 2) 
    openDoor3 = botDoorPath;
    openDoor2 = spaceDoorPath;
    openDoor1 = beachDoorPath; }
};


doorImage1.onclick = () => {
  if (!isClicked(doorImage1)){ 
  doorImage1.src = openDoor1;
  playDoor();
  }
};
doorImage2.onclick = () => {
  if (!isClicked(doorImage2)){
    doorImage2.src = openDoor2;
  playDoor();
  }
};

doorImage3.onclick = () => { 
  if (!isClicked(doorImage3)){
    doorImage3.src = openDoor3;
    playDoor();
  }
};

let gameOver = (status) => {
  if (status === "win") {
    startButton.innerHTML = "You win! Play again?";
  }
};

randomChoreDoorGenerator(); 

Hello, and welcome to the forums!

I noticed the URLs you’re using for the images in your code are different than the ones I have, but they are still valid images. Since your isClicked() function relies on the image source being equal to closedDoorPath, I suggest you actually start debugging by checking out the image URL being used in your index.html file.

There’s a 99% chance the closedDoorPath in the script file doesn’t match the image URL being used for the closed doors in your HTML file. This would mean that isClicked always returns true, so your click logic to change the image never runs. You could change either of them so they match in both files, if this is the case.

Thanks for your reply! The URLs were indeed different and I changed them so they match. The code works now!