Javascript - String toString() Method

The toString() method returns the value of a String object.

Description

The toString() method returns the value of a String object.

Syntax

string.toString()

Parameters

None

Return

A String, representing the value of a string

Example

Return the value of a String object:

Demo

//return the value of the string object.
var str = "Hello World!";
var res = str.toString();
console.log(res);/*www.j av  a 2 s . c  o  m*/

Result