This topic has not yet been rated - Rate this topic

toString Method (Error)

JavaScript - Internet Explorer 10

Returns a string representation of an error.

error.toString()
date

Required. The error to represent as a string.

Returns "Error: " plus the error message.

The following example illustrates the use of the toString method with an error.

var myError = new Error();
myError.message = "My Error";
var errorString = myError.toString();
document.write(errorString);

// Output: Error: My Error

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards. Also supported in Windows Store apps. See Version Information.

© 2013 Microsoft. All rights reserved.