类:ReferenceError
【Class: ReferenceError】
- 继承: <errors.Error>
表示正在尝试访问一个未定义的变量。这类错误通常表示代码中有拼写错误,或者程序本身存在其他问题。
【Indicates that an attempt is being made to access a variable that is not defined. Such errors commonly indicate typos in code, or an otherwise broken program.】
虽然客户端代码可能会生成并传播这些错误,但在实际操作中,只有 V8 会这样做。
【While client code may generate and propagate these errors, in practice, only V8 will do so.】
doesNotExist;
// Throws ReferenceError, doesNotExist is not a variable in this program. 除非应用正在动态生成和运行代码,否则 ReferenceError 实例表示代码或其依赖中存在错误。
【Unless an application is dynamically generating and running code,
ReferenceError instances indicate a bug in the code or its dependencies.】