JavaScript String toString()

The JavaScript string toString() method retrieves a string representing the particular object.

Syntax:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
object.toString()
object.toString()
object.toString() 

Example:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<!DOCTYPE html>
<html>
<body>
<script>
var a ="Hello World!";
document.write(a.toString());
</script>
</body>
</html>
<!DOCTYPE html> <html> <body> <script> var a ="Hello World!"; document.write(a.toString()); </script> </body> </html>
<!DOCTYPE html>
<html>
<body>
<script>
var a ="Hello World!";
document.write(a.toString());
</script>
</body>
</html>