diff --git a/lib/events.js b/lib/events.js index 4ee96024895f45..8cd9cd9582725c 100644 --- a/lib/events.js +++ b/lib/events.js @@ -382,10 +382,7 @@ EventEmitter.prototype.removeAllListeners = // emit removeListener for all listeners on all events if (arguments.length === 0) { - var keys = Object.keys(events); - var key; - for (i = 0; i < keys.length; ++i) { - key = keys[i]; + for (const key of Object.keys(events)) { if (key === 'removeListener') continue; this.removeAllListeners(key); }