Skip to content

toString

js
_.toString(value)

value 转换为字符串。对于 nullundefined 值,将返回一个空字符串。-0 的符号被保留。

¥Converts value to a string. An empty string is returned for null and undefined values. The sign of -0 is preserved.

新增于

¥Since

4.0.0

参数

¥Arguments

  1. value (*):要转换的值。

    ¥value ()*: The value to convert.

返回

¥Returns

(字符串):返回转换后的字符串。

¥(string): Returns the converted string.

示例

¥Example

js
_.toString(null);
// => ''

_.toString(-0);
// => '-0'

_.toString([1, 2, 3]);
// => '1,2,3'

Lodash v4.17 中文网 - 粤ICP备13048890号