toString()  Error  instance method getterS2C Home  « Globals « Error « toString()

Description

Returns a string composed of concatenated error elements delimited by commas.

This method overrides the toString() method of Object.

Syntax

Signature Description
anError.toString()Returns a string composed of concatenated error elements delimited by commas.

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());  

Press the button below to action the above code:


Related Tutorials

JavaScript Advanced Tutorials - Lesson 2 - Errors


go to home page Homepage go to top of page Top