Converts a Boolean
or Number
to String
.
str()
converts values to strings. See the String reference page for guidance on using template literals instead.
The parameter, n
, is the value to convert. If n
is a Boolean, as in str(false)
or str(true)
, then the value will be returned as a string, as in 'false'
or 'true'
. If n
is a number, as in str(123)
, then its value will be returned as a string, as in '123'
. If an array is passed, as in str([12.34, 56.78])
, then an array of strings will be returned.
示例
语法
str(n)
参数
n
String|Boolean|Number:
value to convert.
Returns
String: converted string.
Notice any errors or typos? Please let us know. Please feel free to edit src/utilities/conversion.js and open a pull request!