CCC Docs
    Preparing search index...
    • Convert a NumLike value into a canonical Hex, so prefixed with 0x and containing an even number of lowercase hex digits (full-byte representation).

      Parameters

      • val: NumLike

        The value to convert, which can be a string, number, bigint, or HexLike.

      Returns `0x${string}`

      A Hex string representing the provided value, prefixed with 0x and containing an even number of lowercase hex digits.

      If the normalized numeric value is negative.

      const hex = numToHex(12345); // Outputs "0x3039"