Get to know MDN better
Since March 2025, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
The drop() method of Iterator instances returns a new iterator helper object that skips the given number of elements at the start of this iterator.
The number of elements to drop from the start of the iteration.
A new iterator helper object. The first time the returned iterator helper's next() method is called, the current iterator is immediately advanced by limit elements, and then the next element (the limit+1-th element) is yielded. The iterator helper then yields the remaining elements one-by-one. If the current iterator has fewer than limit elements, the new iterator helper will be immediately completed the first time next() is called.
Thrown if limit becomes NaN or negative when converted to an integer.
The following example creates an iterator that yields terms in the Fibonacci sequence, starting from the 3rd term by dropping the first two terms:
This is equivalent to:
drop() is most convenient when you are not hand-rolling the iterator. Because iterators are also iterable, you can iterate the returned helper with a for...of loop:
You can combine drop() with Iterator.prototype.take() to get a slice of an iterator:
When the limit is negative or NaN, a RangeError is thrown:
When the limit is larger than the total number of elements the iterator can produce (such as Infinity), the returned iterator helper will instantly drop all elements and then be completed the first time next() is called. If the current iterator is infinite, the returned iterator helper will never complete.
| ECMAScript® 2027 Language Specification # sec-iterator.prototype.drop |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jul 10, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.