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'))
It changed all left spaces with x, but It should change every left spaces with one x.
But I just need this output:
xxasdadasdad as asdasd asasd
How can I do it ? Thanks so much.