Chore Door project step 44-50 images do not load

Link to Project https://www.codecademy.com/paths/web-development/tracks/build-interactive-websites/modules/web-dev-interactive-websites/projects/chore-door

I am doing the chore door Project and after changing the onclick function replacing the explicit variables with opendoorX the images wont load.I click and the door stays closed`

let doorImage1 = document.getElementById("door1");
let doorImage2 = document.getElementById("door2");
let doorImage3 = document.getElementById("door3");
let botDoorPath = "https://s3.amazonaws.com/codecademy-content/projects/chore-door/images/robot.svg";
let beachDoorPath = "https://s3.amazonaws.com/codecademy-content/projects/chore-door/images/beach.svg"; 
let spaceDoorPath = "https://s3.amazonaws.com/codecademy-content/projects/chore-door/images/space.svg";
let numClosedDoors = 3;
let openDoor1;
let openDoor2;
let openDoor3;
const isClicked = (door) =>{}
const playDoor = () => {
  numClosedDoors --;
  if (numClosedDoors === 0){
    gameOver();
  }
}

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

doorImage1.onclick=()=>{
  doorImage1.src = openDoor1;
} 
playDoor();
doorImage2.onclick=()=>{
  doorImage2.src = openDoor2;
}
playDoor();
doorImage3.onclick=()=>{
  doorImage3.src = openDoor3;
}
playDoor();
randomChoreDoorGenerator();

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.