This method returns a string representing the specified object.
Its syntax is as follows −
string.toString( )
Returns a string representing the specified object.
Try the following example.
<html> <head> <title>JavaScript String toString() Method</title> </head> <body> <script type="text/javascript"> var str = "Apples are round, and Apples are Juicy."; document.write(str.toString( )); </script> </body> </html>
Apples are round, and Apples are Juicy.