Reply to post: Left padding

How one developer just broke Node, Babel and thousands of projects in 11 lines of JavaScript

AMBxx Silver badge
Boffin

Left padding

I don't do much JavaScript, but is this really the most efficient way to pad a string from the left? What's wrong with a repeat string function then right(lengthNeeded)? This looks like something copied from a BASIC tutorial 20 years ago.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon