Function pad4

  • Formats a number with leading zeros so the resulting string is 4 digits long. Similar to string.padStart(4, '0') but will also format negative numbers similar to how the JavaScript date formats negative year numbers (e.g. -37 is formatted as -000037).

    Parameters

    • num: number

    Returns string