toString()
Error
instance method
JS Home <<
JS Reference <<
Error <<
toString()
Description
Returns a string representation of the specified Error
object.
This method overrides the toString()
method of Object
.
Syntax
Signature | Description |
---|---|
anError.toString() | Returns a string representation of the specified Error object. |
Parameters
None.
Examples
Let's look at an example of using to toString()
method.
// Create our own error object.
var anError = new Error();
alert(anError.toString());
var anotherError = new Error('My Message');
alert(anotherError.toString());
Related Tutorials
JavaScript Advanced Tutorials - Lesson 2 - Errors