Update takeWhile.md
This commit is contained in:
@ -3,10 +3,10 @@ title: takeWhile
|
|||||||
tags: array,intermediate
|
tags: array,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Removes elements in an array until the passed function returns `true`.
|
Removes elements in an array until the passed function returns `false`.
|
||||||
Returns the removed elements.
|
Returns the removed elements.
|
||||||
|
|
||||||
- Loop through the array, using a `for...of` loop over `Array.prototype.entries()` until the returned value from the function is `true`.
|
- Loop through the array, using a `for...of` loop over `Array.prototype.entries()` until the returned value from the function is `false`.
|
||||||
- Return the removed elements, using `Array.prototype.slice()`.
|
- Return the removed elements, using `Array.prototype.slice()`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
Reference in New Issue
Block a user