diff --git a/lib/internal/streams/duplex.js b/lib/internal/streams/duplex.js index bc92e9021ab57c..79f91fa0866e25 100644 --- a/lib/internal/streams/duplex.js +++ b/lib/internal/streams/duplex.js @@ -42,8 +42,10 @@ ObjectSetPrototypeOf(Duplex.prototype, Readable.prototype); ObjectSetPrototypeOf(Duplex, Readable); { + const keys = ObjectKeys(Writable.prototype); // Allow the keys array to be GC'ed. - for (const method of ObjectKeys(Writable.prototype)) { + for (let i = 0; i < keys.length; i++) { + const method = keys[i]; if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; }