JavaScript Interactive Websites - Chore Door Project


#1

I’m in the middle of the Chore Door project and I’ve hit a wall. Before adding the random door generator, everything functions - after adding it, it no longer works. I must have made a mistake between step 37 and 44 but I can’t find it. If anyone has any insight I’d appreciate it! The problematic code is pasted below.

const numClosedDoors = 3;

let openDoor1 =;

let openDoor2 =;

let openDoor3 =;

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 = beachDoorPath;
    openDoor3 = spaceDoorPath;
  } else {
    openDoor3 = botDoorPath;
    openDoor1 = beachDoorPath;
    openDoor2 = spaceDoorPath;
  };
};

door1.onclick = () => {
  doorImage1.src = openDoor1;
};

door2.onclick = () => {
  doorImage2.src = openDoor2;
};

door3.onclick = () => {
  doorImage3.src = openDoor3;
};

randomChoreDoorGenerator();

#2

Please remember to format your code

This just simply stopped working? What code did you have before? After?


#3

project url:

https://www.codecademy.com/paths/web-development/tracks/building-interactive-javascript-websites/modules/web-dev-interactive-websites/projects/chore-door

just for me (and other people helping) to quickly access the project

if i look into the browser console, i see:

SyntaxError: expected expression, got ';' script.js:3:15

so an error in line 3, lets have a look:

let openDoor1 =;

if you want to declare a variable without a value, you can do:

let openDoor1;

or give it a value:

let openDoor1 = undefined;

the combination you have, is not possible i am afraid and will give you a syntax error