English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JavaScript String() Function

 JavaScript Global Properties/Function

The role of the String() function is: to convert the value of an object to a string.

The value returned by the String() function is the same as the toString() of each object.

Syntax:

String(object)
String(true); // true
String(false);// false
String(100);  // 100
String('2 + 6');  // 2 + 6
String(2 + 6);// 8
Test and see‹/›

Browser Compatibility

All browsers fully support the String() function:

Function
String()IsIsIsIsIs

Parameter Value

ParameterDescription
objectA JavaScript Object

Technical Details

Return value:Returns different object values to their strings
JavaScript Version:ECMAScript 1

 JavaScript Global Properties/Function