Home

function: toString


toString(value: *): string

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

Example(s):

toString(null)
// => ''

toString(-0)
// => '-0'

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

Params:

Name Type Attribute Description
value The value to convert.

Returns:

string

  {
    "comment": "/**\r\n * Converts `value` to a string. An empty string is returned for `null`\r\n * and `undefined` values. The sign of `-0` is preserved.\r\n *\r\n * @since 4.0.0\r\n * @category Lang\r\n * @param {*} value The value to convert.\r\n * @returns {string} Returns the converted string.\r\n * @example\r\n *\r\n * toString(null)\r\n * // => ''\r\n *\r\n * toString(-0)\r\n * // => '-0'\r\n *\r\n * toString([1, 2, 3])\r\n * // => '1,2,3'\r\n */",
    "meta": {
        "range": [
            772,
            1368
        ],
        "filename": "toString.js",
        "lineno": 30,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100010274",
            "name": "toString",
            "type": "FunctionDeclaration",
            "paramnames": [
                "value"
            ]
        },
        "vars": {
            "": null,
            "result": "toString~result"
        }
    },
    "description": "Converts `value` to a string. An empty string is returned for `null`\rand `undefined` values. The sign of `-0` is preserved.",
    "since": "4.0.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "Lang",
            "value": "Lang"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "*"
                ]
            },
            "description": "The value to convert.",
            "name": "value"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "string"
                ]
            },
            "description": "Returns the converted string."
        }
    ],
    "examples": [
        "toString(null)\r// => ''\r\rtoString(-0)\r// => '-0'\r\rtoString([1, 2, 3])\r// => '1,2,3'"
    ],
    "name": "toString",
    "longname": "toString",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000942",
    "___s": true,
    "filepath": "toString.js"
}