toString
Summary
Returns a string representation of an error.
Syntax
error.toString()
- date
- Required. The error to represent as a string.
Return Value
Returns "Error: " plus the error message.
Examples
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
Attributions
Microsoft Developer Network: Article