I need help. I am currently working on the Chore Door Project and I cant get my doors to open. I have tried to modify the code multiple times and don’t know what I am doing wrong. If anyone can give any advice on how to that would help immensely.
HTML
<div class = "door-row">
<img id = "door1" class = "door-frame" src = "https://s3.amazonaws.com/codecademy-content/projects/chore-door/images/closed_door.svg">
<img id = "door2" class= "door-frame" src = "https://s3.amazonaws.com/codecademy-content/projects/chore-door/images/closed_door.svg">
<img id = "door3" class = "door-frame" src = "https://s3.amazonaws.com/codecademy-content/projects/chore-door/images/closed_door.svg">
<script type="text/javascript" src="js/robodoor.js"></script>
</div>
Not sure if there are any other problems at this point, but the numClosedDoors & openDoor variables referred to above need to be declared with let instead of const. The preceding variables are fine with const since their assignments will never change.
Yeah that sort of fixed it. The images are now changing when I click, but the source is now undefined rather than the image that I want. I think it is the randomChoreDoor function that is not working correctly now.
var is on the way out but has some value in scoping. let does what var does, except it dials into the block it is declared in.
const means we do not want/expect the value to change. If it is a data structure, then we cannot change the type, but we can change the items in the structure.
I believe your code works as expected for now. Having just reviewed the instructions for this project, it appears you just finished step 44. When you add the function call to randomChoreDoorGenerator() as instructed in step 45, you should see the images when you click on the doors.