Pads the current string with a given string at the beginning.
Syntax
str.padStart(targetLen, padStr?)Example
Enter values below to update the example in real time.
const→code→console→padStart→const code = "42";
console.log(code.padStart(5, "0")); // "00042"
console.log(code.padStart(5)); // " 42"