Jacascript reference error hero not defined

I am getting a red message that says that the hero is not defined, and to try a placeholder. I cannot figure out how to get past that.
The program was working fine yesterday, but started this today.
It is also reading that message on the levels I have already passed.
Can someone help me to get past this?

1 Like

Seeing this error too. Maybe it was a botched deploy.

You can get around it in JavaScript by adding the following snippet to the top of your code:

if (typeof hero === 'undefined') var hero = this;

Basically it checks to see if the hero variable is not defined, and if so, assigns the value of this (which also refers to the hero) to hero.

1 Like

Do you still see it if you clear your cache and reload?

The error seems to be fixed for me now.