Function parseHexadecimal

  • Parses a string to a hexadecimal number. Returns undefined instead of NaN if it fails.

    Example

    parseHexadecimal("101"); // 0x101 -> 257
    parseHexadecimal("101.5"); // 0x101 -> 257
    parseHexadecimal("invalid"); // undefined

    Returns

    Parsed number or undefined if it fails.

    Parameters

    • string: string

    Returns Maybe<number>