valueOf
Summary
Returns the string value of an error.
Syntax
error.valueOf()
Return Value
The string "Error: " plus the error message.
Examples
The following example illustrates the use of the valueOF method with a date.
var myError = new Error();
myError.message = "This is an error.";
var value = myError.valueOf();
document.write(value);
// Output: Error: This is an error.
Remarks
The error object is any instance of an Error.
Attributions
Microsoft Developer Network: Article