Converts `string` to an integer of the specified radix. If `radix` is `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal, in which case a `radix` of `16` is used. **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
parseInt('08')
// => 8
map(['6', '08', '10'], parseInt)
// => [6, 8, 10]
Name | Type | Attribute | Description |
---|---|---|---|
string | The string to convert. | ||
radix | The radix to interpret `value` by. |
{ "comment": "/**\r\n * Converts `string` to an integer of the specified radix. If `radix` is\r\n * `undefined` or `0`, a `radix` of `10` is used unless `value` is a\r\n * hexadecimal, in which case a `radix` of `16` is used.\r\n *\r\n * **Note:** This method aligns with the\r\n * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.\r\n *\r\n * @since 1.1.0\r\n * @category String\r\n * @param {string} string The string to convert.\r\n * @param {number} [radix=10] The radix to interpret `value` by.\r\n * @returns {number} Returns the converted integer.\r\n * @example\r\n *\r\n * parseInt('08')\r\n * // => 8\r\n *\r\n * map(['6', '08', '10'], parseInt)\r\n * // => [6, 8, 10]\r\n */", "meta": { "range": [ 910, 1111 ], "filename": "parseInt.js", "lineno": 30, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo", "code": { "id": "astnode100006894", "name": "parseInt", "type": "FunctionDeclaration", "paramnames": [ "string", "radix" ] }, "vars": { "radix": "parseInt~radix" } }, "description": "Converts `string` to an integer of the specified radix. If `radix` is\r`undefined` or `0`, a `radix` of `10` is used unless `value` is a\rhexadecimal, in which case a `radix` of `16` is used.\r\r**Note:** This method aligns with the\r[ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.", "since": "1.1.0", "tags": [ { "originalTitle": "category", "title": "category", "text": "String", "value": "String" } ], "params": [ { "type": { "names": [ "string" ] }, "description": "The string to convert.", "name": "string" }, { "type": { "names": [ "number" ] }, "optional": true, "defaultvalue": 10, "description": "The radix to interpret `value` by.", "name": "radix" } ], "returns": [ { "type": { "names": [ "number" ] }, "description": "Returns the converted integer." } ], "examples": [ "parseInt('08')\r// => 8\r\rmap(['6', '08', '10'], parseInt)\r// => [6, 8, 10]" ], "name": "parseInt", "longname": "parseInt", "kind": "function", "scope": "global", "___id": "T000002R000638", "___s": true, "filepath": "parseInt.js" }