/array/take
stdTakes up to a given count of elements.
Type signature
(count: number) => <T>(xs: T[]) => T[]
Examples
take(2)([1, 2, 3, 4, 5]);
// ⇒ [1, 2]
Try in REPL
take(10)([1, 2, 3, 4, 5]);
// ⇒ [1, 2, 3, 4, 5]
Try in REPL
Questions
- How to get the first N number of elements from an array?