Home

function: toNumber


toNumber(value: *): number

Converts `value` to a number.

Example(s):

toNumber(3.2)
// => 3.2

toNumber(Number.MIN_VALUE)
// => 5e-324

toNumber(Infinity)
// => Infinity

toNumber('3.2')
// => 3.2

Params:

Name Type Attribute Description
value The value to process.

Returns:

number

  {
    "comment": "/**\r\n * Converts `value` to a number.\r\n *\r\n * @since 4.0.0\r\n * @category Lang\r\n * @param {*} value The value to process.\r\n * @returns {number} Returns the number.\r\n * @see isInteger, toInteger, isNumber\r\n * @example\r\n *\r\n * toNumber(3.2)\r\n * // => 3.2\r\n *\r\n * toNumber(Number.MIN_VALUE)\r\n * // => 5e-324\r\n *\r\n * toNumber(Infinity)\r\n * // => Infinity\r\n *\r\n * toNumber('3.2')\r\n * // => 3.2\r\n */",
    "meta": {
        "range": [
            1001,
            1606
        ],
        "filename": "toNumber.js",
        "lineno": 44,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100009994",
            "name": "toNumber",
            "type": "FunctionDeclaration",
            "paramnames": [
                "value"
            ]
        },
        "vars": {
            "other": "toNumber~other",
            "value": "toNumber~value",
            "isBinary": "toNumber~isBinary"
        }
    },
    "description": "Converts `value` to a number.",
    "since": "4.0.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "Lang",
            "value": "Lang"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "*"
                ]
            },
            "description": "The value to process.",
            "name": "value"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "number"
                ]
            },
            "description": "Returns the number."
        }
    ],
    "see": [
        "isInteger, toInteger, isNumber"
    ],
    "examples": [
        "toNumber(3.2)\r// => 3.2\r\rtoNumber(Number.MIN_VALUE)\r// => 5e-324\r\rtoNumber(Infinity)\r// => Infinity\r\rtoNumber('3.2')\r// => 3.2"
    ],
    "name": "toNumber",
    "longname": "toNumber",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000921",
    "___s": true,
    "filepath": "toNumber.js"
}