Open In App

JavaScript Error.prototype.toString() Method

Last Updated : 12 Jul, 2025
Comments
Improve
Suggest changes
1 Like
Like
Report

The Error.prototype.toString() method is an inbuilt method in JavaScript that is used to return a string representing the specified Error object. 

Syntax:

e.toString()

Parameters: This method does not accept any parameters. 

Return value: This method returns a string representing the specified Error object. 

The below examples illustrate the Error.prototype.toString() Method in JavaScript: 

Example 1: In this example, we will try to return a string using the Error.prototype.toString() Method in JavaScript.

Output:

Error
Error
GeeksForGeeks

Example 2: 

Output:

Error: Error.prototype.toString()
Error: Error.prototype.toString()
Error.prototype.toString()
Error Type

GeeksForGeeks

We have a complete list of Javascript Error Objects, to check those please go through the Javascript Error Object Complete Reference article

Supported Browsers: The browsers supported by Error.prototype.toString() Method are listed below:

  • Google Chrome
  • Firefox
  • Edge

Similar Reads