parseInt
Modified on Mon, 31 Jul 2023
Description
Convert 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
Syntax
parseInt(text, radix)
Parameters
Input Parameter | Type | Description |
---|---|---|
text | string | string The string to convert. |
radix (optional) | number | The radix to interpret `value` by. |
Return value
Type |
---|
number |
Sample
Example | Result | Description |
---|---|---|
parseInt('08') | 8 | Convert string to integer |
To view all the String functions, click here.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article