ChoreBot - Doors Project

Hello, so I made this project and I am not sure where I went wrong with it (Ignoring the CSS).
Given below is my code;
I think the javascript file is bugged, the doors do not open whenever I click on them, please guide me.

Hi.

Forgive me, I normally try to give hints to help people find the problem themselves but there are quite a few things causing your code not to work.

You have defined a function randomDoorGenerator. When you come to call it later you refer to it as randomChoreDoorGenerator. The names need to match.

You try to define a choreDoor variable in the function but you are missing let at the start of the line.

Also in the esle if block of this function you have a typo, you wrote choorDoor instead of choreDoor.

In the else section of the block you need to remove (choreDoor === 2). Else covers all other eventualities and so we can’t add a condition.

In your startRound function the paths you are trying to update don’t exist. They should be doorImage1.src

Your playDoor function makes reference to door but where is that variable coming from? You need to add door as a parameter for the that function eg. funcion playDoor(door){
playDoor(door)

This function is also missing a closing }

With you gameOver function I think you’ve gotten mixed up with declaring using the function keyword and arrow syntax. It should be
const gameOver = (status) => {

I think that’s everything, I tried to make notes as I worked through it.

1 Like

My word, thank you SOOO much for this, not to mention I left out a “}” at the end of “isBot()” function.
I’m such a dumbo I guess, didn’t use VSCode at first otherwise I might’ve fixed a bit myself.
Problem solved.

2 Likes

No worries.

And you’re not dumb, we’re all here to learn and getting it wrong is part of that process. I dare say we can learn more from understanding where we went wrong than just by getting it all right first time around.

I could be wrong I feel like maybe you worked through the steps and left checking if things were working until the end. If that was the case, just try to check things work as you add them. I feel like that would have helped you pick up errors earlier and helped you know where to look for them.

1 Like