diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index 094240c694ea53..12f7cb9e53ce6b 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -259,9 +259,8 @@ function strEscape(str) { last = i + 1; } } - if (last === 0) { - result = str; - } else if (last !== i) { + + if (last !== i) { result += str.slice(last); } return `'${result}'`;