JavaScript » Functions » string

Syntax:
string(object)

The top-level function, string, converts the object argument to a string representing the object's value.

The object argument must be a JavaScript object. If no argument is provided, string returns the empty string, "".

Examples

Code:
boo = new Boolean(0)
document.write(String(boo))
Output:
false
Explanation:

In this example, a new Boolean object is created with an argument of 0. The String function returns, "false", which is the string equivalence of the value of the object.