.padStart(val,num)

Description

Treats the number as a string and returns a new string of length num, padded on the left with val (repeated as needed).

Parameters

  • val — padding string.

  • num — total desired length.

Usage

log 7.padStart("0",3) // "007"

Last updated

Was this helpful?