diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index 85b88a72ea9290..3ff8c1b83c391e 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -115,12 +115,11 @@ function Console(options /* or: stdout, stderr, ignoreErrors = true */) { // Bind the prototype functions to this Console instance const keys = ObjectKeys(Console.prototype); - for (var v = 0; v < keys.length; v++) { - var k = keys[v]; + for (const key of keys) { // We have to bind the methods grabbed from the instance instead of from // the prototype so that users extending the Console can override them // from the prototype chain of the subclass. - this[k] = this[k].bind(this); + this[key] = this[key].bind(this); } this[kBindStreamsEager](stdout, stderr);