Javascript Object toString is an inbuilt function that returns a string representing the object. Every object has the toString() method that is automatically called when an object is to be represented as the text value or when an object is referred to in a manner in which a string is expected.

Javascript Object toString Example

By default, Javascript Object toString() method is inherited by every object descended from the Object.

If this method is not overridden in the custom object, toString() returns “[object type],” where type is an  object type. The syntax is the following.

object.toString()

It returns the  string representing the  object.

#javascript #js #object.tostring

Javascript Object toString Example | Object.toString()
1.60 GEEK