I have following code to replace left spaces with a specific string but, It is not working as I want.
console.log(' asdadasdad as asdasd asasd'.replace(/^s+/, 'x'))
This will surely do in two lines:
var str =' asdadasdad as asdasd asasd'; console.log(str.trim().padStart(str.length, 'x'));
1.4m articles
1.4m replys
5 comments
57.0k users