A ReferenceError indicates that an invalid reference value has been detected (ECMA 5 15.11.6.3)
In practical terms, this means a ReferenceError will be thrown when JavaScript attempts to get the value of an unresolvable reference. (There are other cases where a ReferenceError will be thrown, most notably when running in ECMA 5 Strict mode. If you’re interested check the reading list at the end of this article)
For further reading take a look here.