Skip to main content

numberToHex

Callable

  • numberToHex(value: Numbers, hexstrict?: boolean): string

  • Converts value to it's hex representation

    @example
    console.log(web3.utils.numberToHex(10));
    > "0xa"

    Parameters

    • value: Numbers

      Value to be converted

    • optionalhexstrict: boolean

      Add padding to converted value if odd, to make it hexstrict

    Returns string

    • The hex representation of the input value