This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

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