Identifies the base type of array elements
Identifies the narrowed type when using type guards
The array or array-like object to drop from
Function to test each element. Return true to drop, false to stop dropping
OptionalthisArg: anyOptional value to use as this when executing callbackFn
A new array with leading elements removed while predicate was true
arrDropWhile([1, 2, 3, 4, 1], x => x < 3); // [3, 4, 1]
arrDropWhile([2, 4, 6, 1, 8], x => x % 2 === 0); // [1, 8]
arrDropWhile([1, 2, 3], x => x > 5); // [1, 2, 3]
arrDropWhile([1, 2, 3], x => x < 5); // []
// Array-like objects
arrDropWhile({ length: 4, 0: 1, 1: 2, 2: 3, 3: 4 }, x => x < 3); // [3, 4]
The arrDropWhile() method returns a new array with elements from the beginning removed as long as the predicate function returns true. Once the predicate returns false, all remaining elements (including that one) are included in the result.