diff --git a/lib/_debugger.js b/lib/_debugger.js index 9e1c5844cd7..3e28a3f4cb6 100644 --- a/lib/_debugger.js +++ b/lib/_debugger.js @@ -922,13 +922,17 @@ function intChars(n) { // Adds spaces and prefix to number function leftPad(n, prefix) { - var s = n.toString(); - var nchars = intChars(n); - var nspaces = nchars - s.length; + var s = n.toString(), + nchars = intChars(n), + nspaces = nchars - s.length - 1; + + prefix || (prefix = ' '); + for (var i = 0; i < nspaces; i++) { - s = (prefix || ' ') + s; + prefix += ' '; } - return s; + + return prefix + s; }