类:ReferenceError
¥Class: ReferenceError
-
¥Extends: <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.