Function parseInt

  • 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.

    Note: This method aligns with the ES5 implementation of parseInt.

    Parameters

    • string: string

      The string to convert.

    • Optionalradix: number

      The radix to interpret string by.

    Returns number

    Returns the converted integer.

    1.1.0

    parseInt('08')
    // => 8