diff --git a/lib/events.js b/lib/events.js index 4ccec4e595cdc5..6a8345ab7bc516 100644 --- a/lib/events.js +++ b/lib/events.js @@ -477,9 +477,9 @@ function spliceOne(list, index) { list.pop(); } -function arrayClone(arr, i) { - var copy = new Array(i); - while (i--) +function arrayClone(arr, n) { + var copy = new Array(n); + for (var i = 0; i < n; ++i) copy[i] = arr[i]; return copy; }