strpad in node js code example
Example 1: lpad javascript
str.padStart(targetLength [, padString])
Example 2: string padStart padEnd
let string = ‘Alice’;
// padStart() — we assume our string needs to have 10 characters
string.padStart(10, ‘o’); // returns ‘oooooAlice’
// padEnd()
string.padEnd(10, ‘o’); // returns ‘Aliceooooo’;