padStart()
padEnd()
let str1 = 'a'; console.log(str1.padStart(3, '0')); console.log(str1.padEnd(3, '0')); console.log(str1);
输出结果如下: