Core JavaScript 1.5 Reference:Global Objects:ReferenceError
From MDC
Contents |
Summary
Represents an error when a non-existent variable is referenced.
Description
A ReferenceError is thrown when trying to dereference a variable that has not been declared.
Syntax
new ReferenceError([message[, fileName[, lineNumber]]])
Parameters
- message
- Human-readable description of the error
- fileName
- Non-standard
- The name of the file containing the code that caused the exception
- lineNumber
- Non-standard
- The line number of the code that caused the exception
Properties
For properties inherited by ReferenceError instances, see Properties of ReferenceError instances.
- prototype
- Allows the addition of properties to an ReferenceError object.
Properties inherited from Function.prototype
caller, constructor, length, name
Methods
For methods inherited by ReferenceError instances, see Methods of ReferenceError instances.
The global ReferenceError contains no methods of its own, however, it does inherit some methods through the prototype chain.
Methods inherited from Object.prototype
__defineGetter__, __defineSetter__, hasOwnProperty, isPrototypeOf, __lookupGetter__, __lookupSetter__, __noSuchMethod__, propertyIsEnumerable, unwatch, watch
ReferenceError instances
All ReferenceError instances inherit from ReferenceError.prototype. You can use the prototype to add properties or methods to all instances.
Properties
- constructor
- Specifies the function that created an instance's prototype.
- name
- Error name.
ReferenceError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message.Properties inherited from Error.prototype
fileName, lineNumber, message, name, number, stack
Methods
Although the ReferenceError prototype object does not contain any methods of its own, ReferenceError instances do inherit some methods through the prototype chain.
Methods inherited from Error.prototype
toSource, toString
Methods inherited from Object.prototype
__defineGetter__, __defineSetter__, hasOwnProperty, isPrototypeOf, __lookupGetter__, __lookupSetter__, __noSuchMethod__, propertyIsEnumerable, unwatch, valueOf, watch