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.
string
radix
undefined
0
10
16
Note: This method aligns with the ES5 implementation of parseInt.
parseInt
The string to convert.
Optional
The radix to interpret string by.
Returns the converted integer.
1.1.0
parseInt('08')// => 8 Copy
parseInt('08')// => 8
Converts
string
to an integer of the specified radix. Ifradix
isundefined
or0
, aradix
of10
is used unlessstring
is a hexadecimal, in which case aradix
of16
is used.Note: This method aligns with the ES5 implementation of
parseInt
.