Earlier quoted context omitted.
The package's original implementation[1] also seems like it would have resulted in O(n^2) operation rather than desired O(n). [1] https://en.wikipedia.org/wiki/Npm_left-pad_incident
I don't see where the quadratic time complexity comes from. There's a single loop performing n operations in total, ie. O(n).
That linear-time operation is then additionally repeated `len` times