Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

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?

Python reference error hero not defined

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.


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


The error seems to be fixed for me now.