padding string in javascript code example
Example 1: lpad javascript
str.padStart(targetLength [, padString])
Example 2: js number padding to number of characters
var n = 123
String("00000" + n).slice(-5); // returns 00123
("00000" + n).slice(-5); // returns 00123
(" " + n).slice(-5); // returns " 123" (with two spaces)