Where is my mistake?

I am working now on the project Chore Door, but I have a problem. And I do not understand where is my mistake.
https://www.codecademy.com/paths/web-development/tracks/build-interactive-websites/modules/web-dev-interactive-websites/projects/chore-door
I am now on the task 45, but I cannot complete it. I have been working on the part 1: Lets make this act like a game.
I wrote my code, but, when I call the function and click on the door, there is nothing appear. I need help. Here is my code:


2

I have replaced “FUNCTION” with “CONST” on the line 15, and now it works! But… I do not understand why we should use “CONST” here, and not “FUNCTION”?

Hello, @dariyavolosh9.

It’s just a matter of syntax. To declare a function using the function keyword, the syntax is:

function myFunctionName() {
  //function body
} 

You were using the arrow function syntax which isn’t compatible with the function keyword.

1 Like