We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b017592 commit d6a1870Copy full SHA for d6a1870
ECMASCript 2021/padding.js
@@ -1,17 +1,17 @@
1
// What's the use of `padStart()` and `padEnd()` in JavaScript?
2
-//
+
3
// String padding is often needed to ensure consistent formatting.
4
// Common examples in ServiceNow:
5
// - Padding numeric IDs with leading zeros (e.g., "INC000045")
6
// - Making export data columns align neatly
7
// - Adding placeholders to strings for integration formatting
8
9
// padStart(targetLength, padString)
10
// → Pads a string from the start until it reaches the target length
11
12
// padEnd(targetLength, padString)
13
// → Pads a string from the end until it reaches the target length
14
15
// Example:
16
// "1234".padStart(10, "x"); // → "xxxxxx1234"
17
// "1234".padEnd(10, "y"); // → "1234yyyyyy"
0 commit comments