toString
Modified on Wed, 02 Aug 2023
Description
Convert `value` to a string. An empty string is returned for `null` and `undefined` values. The sign of `-0` is preserved.
Syntax
toString(value)
Parameters
Input Parameter | Type | Description |
---|---|---|
value | any | The value to convert. |
Return value
Type |
---|
string |
Sample
Example | Result | Description |
---|---|---|
toString(22) | '22' | Number to string |
toString(-0) | '-0' | Negative number to string |
toString(-1.23) | '-1.23' | Negative number to string |
toString([1, 2, 3]) | '1,2,3' | List to string |
toString(null) | '' | Convert null value empty string |
To view all the String functions, click here.
See Also
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article