takeWhile

Creates a slice of array with elements taken from the beginning. Elements are taken until predicate returns falsy.

Example