JavaScript Iterator drop()
Example
// Create an iterator
const myIterator = Iterator.from([1, 2, 3, 4, 5, 6]);
// Drop 5
const dropFive = myIterator.take(5);
Try it Yourself »
const myIterator = Iterator.from([1, 2, 3, 4, 5, 6]);
// Drop 5
const dropFive = myIterator.take(5);
Description
The drop()
method returns a new iterator with a specified number of elements dropped.
The drop()
method does not change the original iterator.
Syntax
iterator.drop(number)
Parameters
Parameter
Description
number
Required.
The number of elements to drop.
The number of elements to drop.
Return Value
Type
Description
Iterator An iterator with the resulting elements.
Browser Support
iterator.drop()
is a JavaScript 2025 feature.
ES 2025 is fully supported in all modern browsers since May 2025:
Chrome 136 |
Edge 136 |
Firefox 129 |
Safari 18.2 |
Opera 120 |
Apr 2025 | Apr 2025 | Aug 2024 | Des 2024 | May 2025 |