YouTip LogoYouTip

Jsref String

# JavaScript String() Function [![Image 8: Function Reference Manual](#) JavaScript Global Functions](#) * * * ## Definition and Usage The String() function converts an object's value to a string. ## Syntax String(object) | Parameter | Description | | :--- | :--- | | object | Required. The JavaScript object. | * * * ## Browser Support ![Image 9: Internet Explorer](#)![Image 10: Firefox](#)![Image 11: Opera](#)![Image 12: Google Chrome](#)![Image 13: Safari](#) All major browsers support the String() function. * * * ## Tips and Notes **Note:** The String() function returns the same value as the toString() method of the string object. * * * ## Examples ## Example Convert different objects to strings: var test1 = new Boolean(1); var test2 = new Boolean(0); var test3 = new Boolean(true); var test4 = new Boolean(false); var test5 = new Date(); var test6 = new String("999 888"); var test7 = 12345; document.write(String(test1)+ "
"); document.write(String(test2)+ "
"); document.write(String(test3)+ "
"); document.write(String(test4)+ "
"); document.write(String(test5)+ "
"); document.write(String(test6)+ "
"); document.write(String(test7)+ "
"); The output of the above example: true false true false Thu Jun 18 2026 03:30:17 GMT+0000 (Coordinated Universal Time) 999 888 12345 [Try it yourself Β»](#) * * JavaScript Global Functions](#)
← Jsref UnescapeJsref Regexp Ignorecase β†’