Skip to content

Function.dropWhile

github-actions[bot] edited this page Nov 18, 2026 · 13 revisions

umt / dropWhile

Function: dropWhile()

dropWhile<T>(array, predicate): T[]

Defined in: Array/dropWhile.ts:9

Removes the leading elements of an array while the predicate returns true

Type Parameters

T

T

Parameters

array

T[]

The array to scan

predicate

(value, index, array) => boolean

Function evaluated for each element until it first returns false

Returns

T[]

A new array starting at the first element that fails the predicate

Example

dropWhile([1, 2, 3, 4, 1], (n) => n < 3); // [3, 4, 1]

API

Classes

Interfaces

Type Aliases

Variables

Functions

Clone this wiki locally