English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
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.
String(object)
String(true); // true String(false);// false String(100); // 100 String('2 + 6'); // 2 + 6 String(2 + 6);// 8Test and see‹/›
All browsers fully support the String() function:
Function | |||||
String() | Is | Is | Is | Is | Is |
Parameter | Description |
---|---|
object | A JavaScript Object |
Return value: | Returns different object values to their strings |
---|---|
JavaScript Version: | ECMAScript 1 |