|
Last change
on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
781 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Converts `string` to an integer of the specified radix. If `radix` is undefined or 0, a `radix` of 10 is used unless `string` is a hexadecimal, in which case a `radix` of 16 is used.
|
|---|
| 3 | *
|
|---|
| 4 | * @param {string} string The string to convert to an integer.
|
|---|
| 5 | * @param {number} radix The radix to use when converting the string to an integer. Defaults to `0`.
|
|---|
| 6 | * @param {unknown} guard Enables use as an iteratee for methods like `Array#map`.
|
|---|
| 7 | * @returns {number} Returns the converted integer.
|
|---|
| 8 | *
|
|---|
| 9 | * @example
|
|---|
| 10 | * parseInt('08'); // => 8
|
|---|
| 11 | * parseInt('0x20'); // => 32
|
|---|
| 12 | *
|
|---|
| 13 | * parseInt('08', 10); // => 8
|
|---|
| 14 | * parseInt('0x20', 16); // => 32
|
|---|
| 15 | *
|
|---|
| 16 | * ['6', '08', '10'].map(parseInt); // => [6, 8, 10]
|
|---|
| 17 | */
|
|---|
| 18 | declare function parseInt(string: string, radix?: number): number;
|
|---|
| 19 |
|
|---|
| 20 | export { parseInt };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.