Converts a string to an integer.
parseInt(string, radix?)
string
A string to convert into a number.
radix optional
A value between 2 and 36 that specifies the base of the number in string. If this argument is not supplied, strings with a prefix of ‘0x’ are considered hexadecimal. All other strings are considered decimal.
An integer number.
If the number cannot be converted, NaN is returned.
Number.parseInt("42")
42
Number.parseInt("42", 10)
42
Number.parseInt("2a", 16)
42
Number.parseInt("0x2a")
42
Number.parseInt("10 miles")
10
Number.
parseInt("hello")
NaN